You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Harring Figueiredo <ha...@gmail.com> on 2007/06/19 17:50:33 UTC

Writing the XML Object to a SOAP envelope.

Hello All,

How can I write the XML document to the envelope of another XML (say Soap)
as the body content?

If I do an  object.toString(), the XML is not escaped.

Thank you for any help.

harringf

Re: Writing the XML Object to a SOAP envelope.

Posted by Harring Figueiredo <ha...@gmail.com>.
Hello Jon,

Thank you so much for your reply - I am using JMS and the envelope XML part
is also generated by XMlBeans.

 <header> ... </header>
 <body>  [[CDATA ...  </body>

The document above is generated with the setBody(Strong someXML.).

But the document escapes the XML  markup   " < "  , "</", etc.

I will check to see if it works,

Thank you again for your reply.

Harring.

On 6/19/07, Baker, Jon <ba...@mitre.org> wrote:
>
> I am not sure how your web service is implemented. Maybe this will
> help.
>
> I am using the SAAJ api. In my case the soap body simply contains a
> complete xml document that is written against a preexisting schema. I
> create the document using the XmlBeans code I complied against my
> preexisting schema. I then add the document to the SOAPBody using the
> SAAJ api and the XmlBeans getDomNode() method to get the root node of
> my document. Here is the code I am using:
>
> // get the SOAPBody and add the result xbean document.
> SOAPMessage message = messageFactory.createMessage();
> SOAPBody body = message.getSOAPBody();
> Node node = xbeanDoc.getXXX().getDomNode(); // where XXX is the rot
> element name
> Document doc = node.getOwnerDocument();
> bodyElement = body.addDocument(doc);
>
> Hope that helps,
>
> Jon
>
> ============================================
> Jonathan O. Baker
> The MITRE Corporation
> Email: bakerj@mitre.org
>
>
> >-----Original Message-----
> >From: Harring Figueiredo [mailto:harringf@gmail.com]
> >Sent: Tuesday, June 19, 2007 11:51 AM
> >To: user@xmlbeans.apache.org
> >Subject: Writing the XML Object to a SOAP envelope.
> >
> >
> >Hello All,
> >
> >How can I write the XML document to the envelope of another
> >XML (say Soap) as the body content?
> >
> >If I do an  object.toString(), the XML is not escaped.
> >
> >Thank you for any help.
> >
> >harringf
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

RE: Writing the XML Object to a SOAP envelope.

Posted by "Baker, Jon" <ba...@mitre.org>.
I am not sure how your web service is implemented. Maybe this will
help.

I am using the SAAJ api. In my case the soap body simply contains a
complete xml document that is written against a preexisting schema. I
create the document using the XmlBeans code I complied against my
preexisting schema. I then add the document to the SOAPBody using the
SAAJ api and the XmlBeans getDomNode() method to get the root node of
my document. Here is the code I am using:

// get the SOAPBody and add the result xbean document.
SOAPMessage message = messageFactory.createMessage();
SOAPBody body = message.getSOAPBody();
Node node = xbeanDoc.getXXX().getDomNode(); // where XXX is the rot
element name
Document doc = node.getOwnerDocument();            
bodyElement = body.addDocument(doc);  

Hope that helps,

Jon

============================================
Jonathan O. Baker
The MITRE Corporation
Email: bakerj@mitre.org
 

>-----Original Message-----
>From: Harring Figueiredo [mailto:harringf@gmail.com] 
>Sent: Tuesday, June 19, 2007 11:51 AM
>To: user@xmlbeans.apache.org
>Subject: Writing the XML Object to a SOAP envelope.
>
>
>Hello All,
>
>How can I write the XML document to the envelope of another 
>XML (say Soap) as the body content?
>
>If I do an  object.toString(), the XML is not escaped.
>
>Thank you for any help.
>
>harringf 
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org