cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Seumas Soltysik <seumas.solty...@gmail.com>
Subject Response SOAP Headers with Provider implementation
Date Wed, 15 Feb 2012 07:54:01 GMT
I am using a WSDL which defines an operation which has a SOAP header
defined as part of its output as shown in the WSDL snippets below. The
output takes the response message and puts the WSResponseHeader in the SOAP
header and the FooCallbackPollResponse in the SOAP body.

<message name="FooCallbackPollResponse">
<part name="WSResponseHeader" element="ch:WSResponseHeader"/>
<part name="FooCallbackPollResponse" element="tns:FooCallbackPollResponse"/>
</message>

<output>

<operation name="FooCallbackPoll">
<soap:operation/>
<input>
<soap:header message="tns:FooCallbackPollRequest" part="WSHeader"
use="literal"/>
<soap:body parts="FooCallbackPollRequest" use="literal"/>
</input>
<output>
<soap:header message="tns:FooCallbackPollResponse" part="WSResponseHeader"
use="literal"/>
<soap:body use="literal"/>
</output>
</operation>

For this particular service I am using a Provider implementation which is
operating in MESSAGE mode. In the Provider, the response message is
formulated according the the WSDL above but during processing in the
outgoing server chain the message gets corrupted and the
FooCallbackPollResponse part also ends up in the SOAP header.

This is happening because in
the MessageModeOutInterceptorInternal.handleMessage() call in
MessageModeOutInterceptor the following happens:

            MessageContentsList list =
(MessageContentsList)message.getContent(List.class);

            DocumentFragment frag =
soapMessage.getSOAPPart().createDocumentFragment();
            try {
                Node body = soapMessage.getSOAPBody();
                Node nd = body.getFirstChild();
                while (nd != null) {
                    body.removeChild(nd);
                    frag.appendChild(nd);
                    nd = soapMessage.getSOAPBody().getFirstChild();
                }
                list.set(0, frag);

which strips the child elements of the SOAP body and puts then into
MessageContentsList in place of the SOAPMessage that previously existed
there. This seems rather odd. This causes problems downstream when
SoapOutInterceptor.handleHeaderPart() is called.The effect of this method
is to iterate through the contents of the afore mentioned
MessageContentList containing what was previously in the body of the SOAP
message and print these elements to the output stream, thereby inserting
the tns:FooCallbackPollResponse element in the SOAP header.

So the first issue concerns the stripping of child nodes of the SOAP body
in the MessageModeOutInterceptor. Why is this being done

The second issue is the printing of these elements in the SOAP header in
the SoapOutInterceptor.

I am using version of CXF 2.3.x

Regards,
Seumas Soltysik

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message