Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to call Web Service form Rich Ajax Platform (RAP)?(How to call Web Service form Rich Ajax Platform (RAP)?)
How to call Web Service form Rich Ajax Platform (RAP)? [message #633717] Tue, 19 October 2010 05:48 Go to next message
fangjava  is currently offline fangjava Friend
Messages: 8
Registered: July 2009
Junior Member
I created a web service today with CXF , I want to call it from
Rich Ajax Platform (RAP). I don't know how to to it??

Thanks a lot for your help and suggestions

[Updated on: Tue, 19 October 2010 05:52]

Report message to a moderator

Re: How to call Web Service form Rich Ajax Platform (RAP)? [message #633737 is a reply to message #633717] Tue, 19 October 2010 07:34 Go to previous messageGo to next message
Holger Staudacher is currently offline Holger StaudacherFriend
Messages: 166
Registered: July 2009
Senior Member
The same way you call it from every other Java application.

Regards Holger


<kele20000@sina.com> wrote:
> I created a web service today with CXF , I want to call it from Rich
> Ajax Platform (RAP). I don't know how to to it??
Re: How to call Web Service form Rich Ajax Platform (RAP)? [message #633749 is a reply to message #633717] Tue, 19 October 2010 09:22 Go to previous messageGo to next message
fangjava  is currently offline fangjava Friend
Messages: 8
Registered: July 2009
Junior Member
I see
Thank you very much!
Re: How to call Web Service form Rich Ajax Platform (RAP)? [message #732081 is a reply to message #633749] Mon, 03 October 2011 21:21 Go to previous messageGo to next message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
Hello,

im also trying to create a simple REST Web Service that is running with my RAP application. The call of the service should take some parameters and give back a xml file. The implementation will follow this tutorial but probably more simple (i don't need that maven and spring stuff only simple method that returns a xml depending on the GET parameters):
http://dhruba.name/2008/12/08/rest-service-example-using-cxf-22-jax-rs-10-jaxb-and-spring/
i think, i probably need to edit the web.inf of the rap application, but what is the right way to add my REST servlet and how to call it from the service from the browser properly (GET method)? perhaps can someone give me the smallest possible example with one class and one method that contains one parameter and how it can be called from the browser?

Thx a lot
Best regards, Edin

Re: How to call Web Service form Rich Ajax Platform (RAP)? [message #732344 is a reply to message #732081] Tue, 04 October 2011 14:45 Go to previous messageGo to next message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
Is it possible to add another Servlet to web.xml? in my case:
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Re: How to call Web Service form Rich Ajax Platform (RAP)? [message #732357 is a reply to message #732344] Tue, 04 October 2011 15:08 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

It is certainly possible to add another servlet to the RAP application since it is based on OSGi and uses HttpService to register it's own servlet. You can look up the HttpService via OSGi and register your own servelets, or you can use the extension points provided by org.eclipse.equinox.http.registry. Setting up CXF may be more complicated if it isn't designed to run under OSGi, but I think your approach to modifying the web.xml should work as long as the servlet-class you specify is available.

Why would you need to call a REST service from the browser in RAP? The point of RAP is that your code is run on the server side. The only reason I can think to do this is if you have a Browser widget within your RAP application that is displaying some HTML/javascript which calls back to the server. Be aware that these requests will not be associated with the UI thread in RAP, so extra work will be required to associate requests on the REST service with RAP sessions. For example, things like RWT.getRequest() and PlatformUI.getWorkbench() and Display.getDefault() will not work in your REST servlet.

Good luck,

Cole
Re: How to call Web Service form Rich Ajax Platform (RAP)? [message #733376 is a reply to message #732357] Tue, 04 October 2011 15:42 Go to previous message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
Hi Cole,
well i have the following situation. My RAP applikation has some features that can be normally used over the GUI, sth like: user gives an adress in textfields and gets messagedialog whether this adress is correct or not. The Class checking the adress is running inside of my RAP application and its pretty complex. Right now i want to give an other application (not a RAP application) the possibility to call this method of my RAP application for adress checking. my RAP application then should give back a XML file containing only few tags, telling wheter the adress is right or wrong. so i thought the best way would be to write a RESTfull service that takes the adress as HTTP GET(consisting of some parameters:street, nr, city etc.) and returns an Integer in a xml file, that suggests if the adress is correct. With that xml File the other application can do than some other stuff.
I spoke about the browser because, if i integrate some REST service i would like to know, how to call that service from the firefox, just for testing if the service is working, i am not able to test it from the other application, but when i see the xml file on the firefox, i will know that it works.
Previous Topic:Has anyone deployed Rap on Virgo?
Next Topic:Cleanup (Again)
Goto Forum:
  


Current Time: Sat Oct 05 09:40:23 GMT 2024

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

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

Back to the top