• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

webservice calling from url

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to call web service direcltly using a url is it possible?
If yes how.

Thanks
Miku
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,
Thanks for the reference and the example code.
It is really helpful.
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.



 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic