Friday, 6 September 2013

Getting Request parameters from Spring WS Interceptor

Getting Request parameters from Spring WS Interceptor

I am using Jaxb 2 with a Spring WS, and I have an interceptor which is
directed to a particular payload and it works fine.
Here my requirement is to read the request parameters from the
handleRequest method of my interceptor. I know this should be fairly
straight forward. However could not figure out a way to read the request
parameters. At the moment my handleRequest method looks as below.
@Override
public boolean handleRequest(MessageContext messageContext, Object
endpoint)
throws Exception {
boolean proceed = true;
SaajSoapMessage saajSoapMessage = (SaajSoapMessage) messageContext
.getRequest();
SOAPMessage soapMessage = saajSoapMessage.getSaajMessage();
Document doc = saajSoapMessage.getDocument();
Element element = doc.getElementById("request");
The relevant part of the my Endpoint class is
@PayloadRoot(namespace = NAMESPACE, localPart = "confirOrderRequest")
public @ResponsePayload
ConfirmOrderResponse handleConfirmOrder(@RequestPayload
ConfirmOrderRequest confirmOrderRequest) {
...........
}
Here my requirement is to get the orderId which comes with the
ConfirmOrderRequest in the interceptor handleRequest method, is there a
way to do this directly, or do I need to do some xml parsing for that?

No comments:

Post a Comment