Meaningless Drivel is fun!*
The moose likes Web Services and the fly likes Creating a webservice using XML over HTTP. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Creating a webservice using XML over HTTP." Watch "Creating a webservice using XML over HTTP." New topic
Author

Creating a webservice using XML over HTTP.

lekurwale amol
Ranch Hand

Joined: Apr 22, 2010
Posts: 55
Hi,

My client has a requirement, which involves a call to my webservice. Here, he does not want to send the messages in SOAP envelop. Instead he intends to send simple XML over HTTP. Now, I googled and found out that REST is a kind of webservice, which uses simple XML over HTTP, and does not require any SOAP envelope around.
My questions :
1:- Does REST implementation supports XML request and response as :

<ABCResponse>

<ResponseCode>0000</ResponseCode>

<TestType>SVC
<TestNumber>6732788883456</TestNumber>
</TestType>

</ABCResponse>

2:- Will REST be the right choice considering XML over HTTP, but no SOAP?

3:- Any good tutorial link, with Client and Service, implementing REST.

4:- Can a we create a WSDL out of the REST service implementation?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
0. Don't be so impatient
1. RESTful services support any input or output you care to use, thats the whole point of sticking to the basic HTTP methods. However, XML and JSON are very common.
2. For XML and not SOAP you can go back to XML-RPC Apache open source version. XML-RPC is like the ancestor of SOAP.
3. See the Jersey site for loads of examples
4. In Theory, you can create WSDL for a RESTful service but I think that is a Kludge.

Bill
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
XML over HTTP is not necessarily REST - those are not interchangeable terms.
However, this certainly won't stop you from developing a XML-over-HTTP web service. It is even possible to do this using JAX-WS, so you do not have to rely on some obscure framework - everything is there for you in Java SE 6. Let me know if you want an example.
A very good article about RESTful web services that I suggest you read if you are thinking about developing something like that:
http://www.jroller.com/rickard/entry/the_domain_model_as_rest
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
lekurwale amol
Ranch Hand

Joined: Apr 22, 2010
Posts: 55
William :
0 : Sorry..for being impatient.
1 : ok
2 : "XML-RPC is like the ancestor of SOAP" I tried the sample application on the link..Could deploy and run. My query is, is there any way 'see' the xml request's and responses exchanged?(No tools download please, I cant install any more)

Ivan :
" It is even possible to do this using JAX-WS" . What I read was that JAX-WS uses SOAP protocol to exchange information. Am I right? If not, then is it a simple xml exchange over HTTP?

Also
"XML over HTTP is not necessarily REST".. can you give an idea of other protocols, excluding SOAP or as William suggested XML-RPC?

And, as you said, can you provide the example of JAX-WS

-Amol
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
lekurwale amol wrote:What I read was that JAX-WS uses SOAP protocol to exchange information. Am I right?

JAX-WS does not have to use SOAP. Take a look at section 9.4 in my SCDJWS 5 study notes book here: http://www.slideshare.net/krizsan/scdjws-5-study-notes-3085287
It shows a complete example on how to develop a XML-over-HTTP (no SOAP) web service with JAX-WS.

"XML over HTTP is not necessarily REST".. can you give an idea of other protocols, excluding SOAP or as William suggested XML-RPC?

REST is not a protocol, but an architectural style. Read about it here: http://en.wikipedia.org/wiki/Representational_State_Transfer
If you, for instance, remove one of the constraints, then, as far as I am concerned, you no longer have REST, but perhaps XML-over-HTTP.
Again, read the article I recommended in the previous post. I feel that very few people have really understood what REST really is about and the majority of what is claimed to be RESTful web services really are nothing more than XML-over-HTTP or JSON-over-HTTP web services. While this is perfectly fine, I feel it is inappropriate to call them RESTful web services.
Best wishes!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
The only way to capture the complete request and response text just has to be a tool such as TCPMON, but don't worry, this is not some complex monstrosity and won't take much learning curve.

Something like TCPMON is a good thing to have in your toolbox if you are going to be working with web services.

Bill
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Hi William,
Good that you mentioned about TCPMON. Is this something similar to Fiddler and WireShark? If so, any extra advantages of TCPMON over the ones I mentioned?


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
 
 
subject: Creating a webservice using XML over HTTP.