dev@jax-ws.java.net

StreamMessage.copy() for multiple parts in a SOAP message body

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Sun, 07 Jan 2007 13:44:18 -0800

Hi Paul/Kohsuke,

There is an issue regarding jaxws not able to consume SOAP message body
having multiple parts. For example message such as :

<?xml version="1.0" ?>
<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
        <first xmlns="http://first.body"></first>
        <second xmlns="http://second.body"></second>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This should work atleast for Dispatch<SOAPMessage> and
Provider<SOAPMessage> mode given there is no intermediate message
conversion other than to SAAJMessage etc.

With some changes its kind of working except when there is a DumpTube,
which calls StreamMessage.copy(). This is what I am trying to do inside
StreamMessage.copy():

-----
                MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
                StreamReaderBufferCreator c = new
StreamReaderBufferCreator(xsb);
               
                //write all the soapenv:Body parts
                while(reader.getEventType() !=
XMLStreamConstants.END_DOCUMENT){
                    String name = reader.getLocalName();
                    String nsUri = reader.getNamespaceURI();
                    if(name.equals("Body") &&
nsUri.equals(soapVersion.nsUri) || (reader.getEventType() ==
XMLStreamConstants.END_DOCUMENT))
                        break;

                    c.create(reader);
                }

                reader = xsb.readAsXMLStreamReader();
                clone = xsb.readAsXMLStreamReader();

------

Above I assume that c.create() will append the second body part to the
document being created. Meaning when I do nextTag() in a loop till
END_DOCUMENT event is reach I will get 2 tages. Latter on when I get
StreamReaderBufferProcessor from XMLStreamBuffer, then while reading the
elements from it I will get both the body parts.

Problem is that when I read latter from StreamReaderBufferProcessor, it
gives me only one body part. After reading the first element it gives
the next event as END_DOCUMENT and somehow does not give me the second
one, even though it was written on the XMLStreamBuffer.

What do I need to do to get such functionality?

-vivek.