Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jaxws How to read the request in SOAPHandler?

 
saxena vicky
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Requirement is to read the soap request in SOAPHandler, look out for some particular elements in the request and take some action based on element value.
I can get any type of request, but I will lookout for “userid” element in the request
like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.net.test/">
<soapenv:Header/>
<soapenv:Body>
<ws:getAccountList>
<!--Optional:-->
<userid>9999999999999</userid>
</ws:getAccountList>
</soapenv:Body>
</soapenv:Envelope>

I tried many option but no success, can anyone suggest the better approach
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try implementing the LogicalHandler which provides access to the SOAP payload (body) regardless of the transport used.

For an example of using LogicalHandler , you can look at the ServerLogicalHandlerBase.java here

BTW, Which framework are you using? CXF, Spring, Axis2 ?
 
saxena vicky
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JAX WS, I want to know is there any way to get the element from the request, the way we do in DOM tree to get element by the name.
I didnt find any api in Handlers.

The approcah which i followed is to convert the request into the string xml and then creating the DOM object with the string xml and then looked for the first node and searched for the element, It worked but I am not convinced with this approach, this will hit the performance.

I want direct api to access the element from the request.
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the example in the link that I provided


You can get a Source object on which you directly apply XSL transformation using the TrAX API which is described here
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic