File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Writing a web service to read XML message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Writing a web service to read XML message" Watch "Writing a web service to read XML message" New topic
Author

Writing a web service to read XML message

Aniket Pathak
Greenhorn

Joined: Mar 13, 2006
Posts: 22
HI,

I am writing my first web service for a specific request. I am going through lots of online document but not able to find a perfect link.

I want to write a Web Service which will get following XML message. Web service will parse this message and send a response if required.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:iiw="http://iiws.innotrac.com/INOC_ATS_IIWS/V7_2/outbound/shared/services/iiwsOutbound">
<soap:Header/>
<soap:Body>
<OrderConfirmation>
<OrderID>80634928</OrderID>
<OrderStatus>200</OrderStatus>
<OrderNumber>10014</OrderNumber>
</OrderConfirmation>
<OrderConfirmation>
<OrderID>891634445</OrderID>
<OrderStatus>230</OrderStatus>
<OrderNumber>10567</OrderNumber>
</OrderConfirmation>
</soap:Body>
</soap:Envelope>

Please help me with this or suggest me a link or any guidelines so I can take it forward.

thanks
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Normally the SOAP stack would bind the data to data structures you keep on the server; or is this payload of a larger SOAP message that encapsulates this XML? Which SOAP stack and which API are you using?
Aniket Pathak
Greenhorn

Joined: Mar 13, 2006
Posts: 22
Lester Burnham wrote:Normally the SOAP stack would bind the data to data structures you keep on the server; or is this payload of a larger SOAP message that encapsulates this XML? Which SOAP stack and which API are you using?


Sorry but really not sure about the SOAP stack. I tried using Axis api to build the service.
I am just not able to get the proper implementation method. The XML given in the post will be sent to me by another application. So I need to host a web service to consume this message parse and process it with requires business logic and send a response back.
The given XML will be provided as it is without any inbuild large message or any object just plan values present in the XML tags.

Hope I have given the rite information required.

thanks.
Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
I am not sure I understand what you are asking.
Usually when someone writes a web service, he also publishes a wsdl. This wsdl (which serves as an interface to the web service) is either created manually and the web service class is created using an automatic wsdl2java tool or the java class is annotated to act as a web service and the wsdl is generated dynamically by the annotations.
Once these steps are finished and the web service is deployed, the framework will do all the xml parsing (including SOAP parsing) and you just implement a java method. So what do you mean "The given XML will be provided as it is without any inbuild large message or any object just plan values present in the XML tags. "
You will just implement a java method using the method arguments. The framework will handle the mapping of the parameters to your web method. This includes the response.
Does this answer your question?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing a web service to read XML message
 
Similar Threads
content not allowed in prolog exception
Mock exam question: SOAP doubt
adding arbitary xml to soap headers using SAAJ
WSDL2JAVA Namespace Issue
document Vs rpc message styles