You're welcome. Glad to hear that it worked.

Sadeep

On Tue, Jul 3, 2012 at 4:36 PM, Wright, Peter <[email protected]>wrote:

> Hi Sadeep,
>
> Your solution works perfectly.
>
> Thanks a lot,
> Peter
>
> -----Original Message-----
> From: Sadeep Jayasumana [mailto:[email protected]]
> Sent: Dienstag, 3. Juli 2012 06:13
> To: [email protected]
> Subject: Re: Synapse: Exception from PayloadHelper.setXMLPayload
>
> Hi,
>
> The following code is used in several places in the current Synapse trunk
> to replace message payload. It should be possible to use the same in your
> context.
>
> SOAPBody soapBody = mc.getEnvelope().getBody();
>
> for (Iterator itr = soapBody.getChildElements(); itr.hasNext();) {
>     itr.next();
>     itr.remove();
> }
>
> for (Iterator itr = xmlElem.getChildElements(); itr.hasNext();) {
>     OMElement child = (OMElement) itr.next();
>     itr.remove();
>     soapBody.addChild(child);
> }
>
> Instead of the second for loop you might want to
> use soapBody.addChild(xmlElem), depending on the requirement.
>
> Thanks,
> Sadeep
>
> On Mon, Jul 2, 2012 at 9:29 PM, Wright, Peter <[email protected]
> >wrote:
>
> > Hi,
> >
> > I have a JMSListener that receives a JMS message containing a path to an
> > XML file on a REST server.
> > A Class Mediator gets the REST-path from the message and http-GETs the
> XML
> > file.
> > Now I want to set the XML file content as the payload of the message that
> > is then passed further
> > to a SOAP service.
> >
> > I get the file content OK in my class mediator, but get an error when
> > trying to set
> > the content as the XML payload.
> >
> > Java Code:
> > InputStream istr = getFileFromRestServer(path);
> > String xmlstr = convertStreamToString(istr);
> > OMElement xmlElem = AXIOMUtil.stringToOM(xmlstr);
> > PayloadHelper.setXMLPayload(mc, xmlElem);
> >
> > Error Message:
> > java.util.ConcurrentModificationException: The current node has been
> > removed using a method other than Iterator#remove()
> >
> > Any ideas?
> > The xmlstr and xmlElem look fine when I print them to STDOUT.
> >
> > I initially tried to set the payload as follows:
> > mc.getEnvelope().getBody().getFirstElement().setText(xmlstr);
> > instead of using setXMLPayload.
> > This worked, but all the xml start tags "<" in the payload are encoded as
> > "&lt;"
> >
> > Thanks
> > Peter
> >
> >
> >
> >
> > The content of this e-mail is intended only for the confidential use of
> > the person addressed.
> > If you are not the intended recipient, please notify the sender and
> delete
> > this email immediately.
> > Thank you.
> >
>
>
>
> --
>
> Sadeep Jayasumana
>
> **
>
> Email: [email protected]****
>
> Mobile: +61 4 1468 8521
> The content of this e-mail is intended only for the confidential use of
> the person addressed.
> If you are not the intended recipient, please notify the sender and delete
> this email immediately.
> Thank you.
>



-- 

Sadeep Jayasumana

**

Email: [email protected]****

Mobile: +61 4 1468 8521

Reply via email to