• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can a servlet have both soap request and simple request

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic