I'd use a StringBuffer object to build the XML string the way you need it to
be and then do something like this:

DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
Document doc = xdb.parse(new InputSource(new
StringReader(stringBuffer.toString())));
Envelope env = Envelope.unmarshall(doc.getDocumentElement());

And then you can send the message:

Message msg = new Message();
msg.send(url, "", env);


That should get you started...






Hi all

Please forgive me if this is a daft question as I am relativley new to
Apache SOAP.

I am trying to send a SOAP message to a proprietry SOAP server, the
message looks like this.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Body>
<m:putPerson xmlns:m="http://www.myurl.org/gateway/";
TimeStampGMT="2002-01-18T10:26:22" Version="1.0">
<Name>ALEX</Name>
<Address>
<Line1>25 The Road</Line1>
<Town>London</Town>
<County>Sussex</County>
</Address>
</m:putPerson >
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The problem I am having is how to create the structed XML for the Body
of the message. I can create a message using a flat structure, i.e

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Body>
<m:putPerson xmlns:m="http://www.myurl.org/gateway/";
TimeStampGMT="2002-01-18T10:26:22" Version="1.0">
<Name>ALEX</Name>
<Line1>25 The Road</Line1>
<Town>London</Town>
<County>Sussex</County>
</m:putPerson >
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Is there a way to create the structured XML?

Thanks in advance

Alex


Reply via email to