• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

webservice calling from url

 
Miku Ranjan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
Thanks for the reference and the example code.
It is really helpful.
 
H Paul
Ranch Hand
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic