Tuesday, August 21, 2007

How to validate request in jax-ws


JAX-WS has the hole in validate soap request. But we can work around by using SoapHandler and JAXP to validate soap request.
As we can see from the picture from the left, we have 2 chance to validate request:
SOAPHandler and LogicalHandler. We use SOAPHandler if we want to validate soap header and soap body and use logicalhandler to validate soap body.

In method: handleMessage() in class SOAPHanlder, we can easily get the raw soap message by using: SOAPMessageContext and write them to ByteArrayOutputStream. After we got the xml string, we can use JAXP to validate the request. Detail in how to implement the idea will be presented in next post.

Google