I have created a simple xml document as a DOM object e.g.
<XppTrade>
 <TradeId>314159TKM901</TradeId>
</XppTrade>

I want to send this as a SOAP message to a web service in apache axis
using the message method (as opposed to RPC).
What is the easiest way to insert the DOM object into the SOAP message?

For example I have tried:
1) org.apache.axis.message.SOAPEnvelope env = new SOAPEnvelope();
2) org.apache.axis.message.SOAPBody sb = env.getBody();
3) org.apache.axis.message.SOAPBodyElement sbe =
env.getBody().addDocument(myDOMdoc);

However in lines 2 and 3 the SOAPBody and  SOAPBodyElement objects
returned from the SOAPEnvelope are of type javax.xml.soap.SOAPBody and
javax.xml.soap. SOAPBodyElement not org.apache.axis.message...

So what's going on here?
The only other examples I have seen are loading the dom doc into the
envelope as a file via an i/o input stream or by adding each
SOAPBodyElement like:
input[0] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo", "e1",
"Hello"));
call.invoke( input );

I'd rather just add the DOM object if I can.

Many thanks in advance

Tom

Reply via email to