my dog learned polymorphism
The moose likes Web Services and the fly likes Web Services-SOAP over HTTP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Services-SOAP over HTTP" Watch "Web Services-SOAP over HTTP" New topic

Web Services-SOAP over HTTP

akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
I am newbie to web services.

I created a web service class with the necessary SOAP annotations and a few web methods within, and generated .wsdl from it using axis - ant build. Now I generated the client code from the .wsdl again using the axis build. Deployed my web service class as a web project in my jboss with the necessary web.xml and the communication to the web service methods works just fine.

Now my aim is to send HTTP POST and GET using SOAP. How do i do this? I checked the xml that goes to and fro whenever i make the web service call... There is nothing in it to state it as a GET or POST...

Googling showed that the SOAP requests over HTTP will have header something like below, which my guys doesnt :

POST /jwsbook/BookQuote HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: 295

How do I make my requests have a header like this??

Is there anything to be specified in the web service class or in my java2wsdl axis build, so that the wsdl file created from it shows support for GET/POST..

Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1183
Please pay attention to the following SOAP article. It says -

Most uses of HTTP as a transport protocol are done in ignorance of how the operation would be modeled in HTTP.[citation needed] This is by design—similar to how different protocols sit on top of each other in the IP stack. But this analogy is imperfect; the application protocols used as transport protocols aren't really transport protocols. As a result, there is no way to know if the method used is appropriate to the operation. This makes good analysis at the application-protocol level problematic with sub-optimal results—for example, a POST operation is used when it would more naturally be modeled as a GET. The REST architecture has become a web service alternative that makes appropriate use of HTTP's defined methods.


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
I fear I do not quite understand your question. What do you want to do?
1. Send requests to the web service using a client with generated artifacts.
2. Send requests to the web service using a client that does not use generated artifacts, i.e. that assembles SOAP messages in the code.
3. Send requests to the web service using arbitrary HTTP client, like Apache HttpClient, the Jetty HttpClient or the means supplied by the Java JDK.
4. Something else.
Best wishes!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
SOAP-based WS always use POST, never GET. If being able to use GET is for some reason paramount (why?), then you'll have to use a RESTful WS (probably using the JAX-RS API).
akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
Thanks for the reply ....

I am fine with having a POST communication..
I agree. Here's the link:
subject: Web Services-SOAP over HTTP
jQuery in Action, 3rd edition