my dog learned polymorphism*
The moose likes Web Services and the fly likes webservice calling from url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "webservice calling from url" Watch "webservice calling from url" New topic
Author

webservice calling from url

Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi,
I want to call web service direcltly using a url is it possible?
If yes how.

Thanks
Miku
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Of course it is possible, how depends on the service so you will need documentation of the service.

1. if a SOAP service you will need to create a SOAP message as a request to the URL.
2. if a REST service you will need a URL that is correctly formatted to address the service HTTP method desired

Bill
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 418
    
    4
I'll give you what I have - no more no less

Assume, you use window

1. Go to http://maven.apache.org/download.html

Download maven

2. Go to http://www.jboss.org/resteasy
Download resteasy-jaxrs-2.2.3.GA-all.zip
Unzip it to C:\ drive for example.

Go to
resteasy-jaxrs-2.2.3.GA\examples
examples\oreilly-workbook\oreilly-workbook
examples\oreilly-workbook\ex03_1
read README.txt

Basic: resteasy-jaxrs-2.2.3.GA is an implementation of JAX-RS - Restful web service.

ex03_1 has a client using URL. So here you have an example of using URL to talk to Restful web service on the server side.

Run the example;

C:\\resteasy-jaxrs-2.2.3.GA\examples\oreilly-workbook\ex03_1>mvn install
you will the output on the command line

For more: Use your friend GOOGLE for key words like:

Restful web service with URL
Soapful web service with URL
Soapful JAX-WS web service
Restful JAX-RS web service
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 418
    
    4
For Restful web service, below are 2 different CLIENT ways:

1. Use Jersey JAX-RS client API
2. Use Apache HttpClient 4.x

If you scan the code, you will see that I'm NOT the President.

Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi Paul,
Thanks for the reference and the example code.
It is really helpful.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 418
    
    4
For Server side, I re-write my Rest President to Soap President

For Client side, I use Apache-HttpClient/4.1.2 to send a Soap Request to the Server. The Soap Request is hard-coded.

Normally, for fun, we do this way because we should use JAX-WS or SAAJ by constraint.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: webservice calling from url