Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Which Webservice should I use? SOAP or RESTful?  RSS feed

 
Srinivas Karthik
Greenhorn
Posts: 28
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings Ranchers,
I'm quite confused here.I need to develop a webservice which actually queries the database and create an xml out of it and put it in SOAP Body and return it.I used Axis which is a eclipse plugin Bottom up approach, when I gave my class as a webservice target. It said Connection not supported SOAPMessage not supported etc. I just couldn't find a way through this though I spent a lot of time in researching.So, I ended up in using REST webservice which queries the database and creates an XML and returns the document.But it is a temporary solution.

Please give your input on how to make things work the way I needed.
I recap what I need once again,
a.I need to create a webservice which queries the database and get some info and forms and xml out of it
b.But the formed xml in SOAP-Body and return the SOAPMessage

Also correct me if I'm wrong anywhere and point me to the right direction.

Thanks a lot in advance.


 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a RESTful architecture to me but consider these questions:

1. Do your clients ever submit a request that modifies the database?
2. To what extent do you have to authenticate your clients?
3. Roughly how big is the XML response payload - are we talking 10,000 characters or millions?

Bill

 
Srinivas Karthik
Greenhorn
Posts: 28
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:Sounds like a RESTful architecture to me but consider these questions:

1. Do your clients ever submit a request that modifies the database?
2. To what extent do you have to authenticate your clients?
3. Roughly how big is the XML response payload - are we talking 10,000 characters or millions?

Bill



1.The client doesn't modify the database but just queries and retrieves the information
2.No need of authentication
3.Hmm the xml size varies.Consider for the moment it's 10000 characters.

What should be done?
 
Kesava Krishna
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please paste the error you got. Also please convert your database queries output to value objects which are nothing but xml beans. Your web service operations should output these xml beans and axis automatically takes care of converting the xml bean to xml(soap message). And your deal done here.

Thanks,
Kesava
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clearly a REST style interface, you don't need anything more than the standard servlet classes to create an XML document and return it as the response to a HTTP GET request. Easily done as a servlet.

No need to involve JAXB or any other toolkit, just write to the servlet output stream.

No need for:
b.But the formed xml in SOAP-Body and return the SOAPMessage

as far as I can see from your description.
 
Srinivas Karthik
Greenhorn
Posts: 28
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kesava Krishna wrote:Please paste the error you got.


I'm getting the below error when trying to create web service using Bottom-Up Approach.
Also please correct me If I'm doing some blunder here.

The service class "MyWebService" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.
The method "createConnection" on the service class "MyWebService" uses a data type, "java.sql.Connection", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
The value type "org.w3c.dom.Element" used via the service class "MyWebService" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization.
The value type "org.w3c.dom.TypeInfo" used via the service class "MyWebService" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization.

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!