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 Jaxws How to read the request in SOAPHandler? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Jaxws How to read the request in SOAPHandler?" Watch "Jaxws How to read the request in SOAPHandler?" New topic
Author

Jaxws How to read the request in SOAPHandler?

saxena vicky
Greenhorn

Joined: Sep 05, 2005
Posts: 18
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

Joined: Jan 29, 2002
Posts: 76
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 ?


Meghana Reddy
saxena vicky
Greenhorn

Joined: Sep 05, 2005
Posts: 18
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

Joined: Jan 29, 2002
Posts: 76
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jaxws How to read the request in SOAPHandler?