I have endpoints which handle various messages with different rootQNames. I have extended in each case the AbstractMarshallingPayloadEndpoint and send back a corresponding response message in the invokeInternal() method - all works well when the messages are unmarshalled correctly.
However, I still need to send a response message back to the client even if an unmarshalling exception is thrown, and the response message must be specific the request, for example, if a <Foo ...> message comes in, the client is expecting a <FooResponse ... > message to come back regardless of any errors. Thus if a request message is well-formed, but an extraneous or mispelled attribute is included and a unmarshalling exception is thrown, I still need to the code in the invokeInternal method to be called to send a response, but currently the org.springframework.oxm.jibx.JibxUnmarshallingFail ureException I am getting prevents invokeInternal from being called.
I thought about using onUnmarshalRequest, but this gets called after the message has attempted to be unmarshalled. The exception is already thrown at this point, according to the code in the invoke method of AbstractMarshallingPayloadEndpoint:
How can I solve this problem?Code:public final void invoke(MessageContext messageContext) throws Exception { WebServiceMessage request = messageContext.getRequest(); Object requestObject = unmarshalRequest(request); if (onUnmarshalRequest(messageContext, requestObject)) { Object responseObject = invokeInternal(requestObject); if (responseObject != null) { WebServiceMessage response = messageContext.getResponse(); marshalResponse(responseObject, response); onMarshalResponse(messageContext, requestObject, responseObject); } } }
Thanks
Alan


Reply With Quote