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 can a servlet have both soap request and simple request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "can a servlet have both soap request and simple request" Watch "can a servlet have both soap request and simple request" New topic
Author

can a servlet have both soap request and simple request

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 417
I have to make a servlet which will take a request and then it has to check, whether the request has come in the form of soap message or a simple request and then do something accordingly.Please tell me how we can do this.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12681
    
    5
Perhaps you could look at the request headers and forward the request to either a SOAP handling servlet or a simple request handling servlet. Do you have some particular SOAP toolkit in use already? What will be generating the client side request?

Bill


Java Resources at www.wbrogden.com
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
In the servlet's doPost method check the content type (ServletRequest.getContentType()). For a SOAP message this will be "text/xml", "application/xml" or "application/soap+xml". If it is one of those types use ServletRequestgetInputStream() or ServletRequest.getParameter("DATA") to access the request body. Then check whether it contains a SOAP envelope. Using XPath is probably the easiest way of accomplishing this.


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 417
thanks
 
Don't get me started about those stupid light bulbs.
 
subject: can a servlet have both soap request and simple request
 
Similar Threads
Sending calls from SOAP files
XML and SOAP ?
Invoking JAX-WS method from browser
RPC SOAP Client in Javascript
Problems reading the request.inputStream()