Hi Vivek,
Vivek Pandey wrote:
> 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;
>
Did you mean to use XMLStreamConstants.END_ELEMENT ?
> 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.
Yes, and that method should throw an exception if the reader is not
positioned at the start of the document or an element.
> Meaning when I do nextTag() in a loop till
> END_DOCUMENT event is reach I will get 2 tages.
I do not see a 'nextTag' being called in the loop.
The create method, when finished, will ensure that the reader is
positioned at the next event *after* the end element event. This implies
if you call next or nextTag it will skip the second element in the SOAP
body and move the read to the end element of the SOAP body.
If no next or nextTag is explicitly called then i cannot see why the
code should not work.
Note: creating a buffer from element content (assuming elements are
separated by ignorable WS or ignorable comments) would be useful
functionality that is part of XMLStreamBuffer.
Paul.
> 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.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: dev-help_at_jax-ws.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109