Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to call the methods of client remoteobject from server side
How to call the methods of client remoteobject from server side [message #1386292] Mon, 16 June 2014 07:59 Go to next message
Eclipse UserFriend
Hi:
I am writing rap program with remoteobject. inthe server side remoteobject I want to call a method defined in the client remoteobject. I tried to use call(method,properties), but nothing happened. I really need the immediate results in the server side remoteobject. so I do not want to implement it by notification.
could anyone help me?
regards!
Re: How to call the methods of client remoteobject from server side [message #1386297 is a reply to message #1386292] Mon, 16 June 2014 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
in your client typeHandler you have to define all available methods that
will be called by the server:
------
rap.registerTypeHandler( "my.customWidgetType", {
....
methods : [ "callMe" ]
} );
------
See also RAP custom widgets FAQ:
https://wiki.eclipse.org/RAP/Custom_Widgets_FAQ

HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to call the methods of client remoteobject from server side [message #1386298 is a reply to message #1386297] Mon, 16 June 2014 08:13 Go to previous messageGo to next message
Eclipse UserFriend
thanks Ivan for your reply. I defined the methods in my client handler. but when in called in the server side,nothing happened. could you show me how to call in the server side remoteobject with an example? thanks very much.
Re: How to call the methods of client remoteobject from server side [message #1386301 is a reply to message #1386298] Mon, 16 June 2014 08:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
it's like in your example:
remoteObject.call( "methodName", properties );
..... and in your typeHandler you have:
"methods" : [ "methodName" ]
The function "methodName" is actually implemented in your JavaScript
custom widget object.
Do you see your method called in the protocol JSON message?
HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to call the methods of client remoteobject from server side [message #1386302 is a reply to message #1386301] Mon, 16 June 2014 08:38 Go to previous messageGo to next message
Eclipse UserFriend
no,I can get nothing at all. I defined a method as:
methodname: function(){
//do something
}
is that right? or how should I define the methods in the Javascript?
Re: How to call the methods of client remoteobject from server side [message #1386307 is a reply to message #1386302] Mon, 16 June 2014 08:50 Go to previous messageGo to next message
Eclipse UserFriend
Yes... that's correct.
Could you attach your custom widget source code... or part of it
responsible for method call? Please look at HTTP response when you call
the method from the server-side. Do you see a JSON call operation in the
protocol message? A fragment like:

|["call","w13","myMethod",{}]|

Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to call the methods of client remoteobject from server side [message #1386317 is a reply to message #1386307] Mon, 16 June 2014 09:37 Go to previous messageGo to next message
Eclipse UserFriend
okay.
in the client side:
rap.registerTypehandler("demo.customwidget",{
......
methods: ["testcall"]

......
});

demo.customwidget.prototype={
testcall : function(){
//do something
}
......
in the server side:

remoteobject.call("testcall",null);



at the same time, I want to get a string alike result from the call. could the remoteobject call make it?
Re: How to call the methods of client remoteobject from server side [message #1386319 is a reply to message #1386317] Mon, 16 June 2014 09:54 Go to previous messageGo to next message
Eclipse UserFriend
and I use livehttpheaders in firefox catch the http response. but I can not see anything about method call.
Re: How to call the methods of client remoteobject from server side [message #1386323 is a reply to message #1386319] Mon, 16 June 2014 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
your code looks good. If there is no call operation in response JSON
message your remoteObject.call is not invoked. Without a complete widget
code I can't help you much.
Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to call the methods of client remoteobject from server side [message #1386828 is a reply to message #1386323] Fri, 20 June 2014 19:16 Go to previous messageGo to next message
Eclipse UserFriend
thanks very much. I fixed it.
Re: How to call the methods of client remoteobject from server side [message #1387595 is a reply to message #1386828] Wed, 25 June 2014 05:52 Go to previous message
Eclipse UserFriend
Hi,
please share with the community what was the problem.
Thanks,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:RAP e4 for Luna. How to install?
Next Topic:Workbench and Sessions
Goto Forum:
  


Current Time: Thu Jul 17 00:50:56 EDT 2025

Powered by FUDForum. Page generated in 0.06466 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top