Try following:
Envelope envelope = new Envelope();
body = new Body();
Vector v = new java.util.Vector();
Vector v.addElement(your-Elements);
body.setBodyEntries(v);
envelope.setBody(body);
java.io.StringWriter sw = new StringWriter();
envelope.marshall(sw, reg, resCtx);
resCtx.setRootPart(sw.toString(), "text/xml");
regards,
Yong Chen
-----Original Message-----
From: Shang, Wencheng (Exchange) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 10:59 AM
To: '[EMAIL PROTECTED]'
Subject: how to construct a valid envelope object
Quote from Writing Message Services section of Apache SOAP documentation
If you want to send a SOAP Envelope back to the client, you can use the
org.apache.soap.Envelope's marshall(...) method to marshall your envelope to
a java.io.StringWriter, and then invoke the response context's
setRootPart(...) method, passing the StringWriter as the first argument
But the question is how do I instantiate a valid Envelope object? I have
tried several combination such as
Envelope resEnv = new Envelope();
Body body = new Body();
Header header = new Header();
resEnv.setHeader(header);
resEnv.setBody(body);
Vector vec = new Vector();
vec.addElement(new Bean(java.lang.String.class, new
BeanSerializer()));
resEnv.setEnvelopeEntries(vec);
But the client program receive an error
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Exception from service object: null</faultstring>
<faultactor>/soap/servlet/messagerouter</faultactor>
</SOAP-ENV:Fault>
The document and samples doesn't have any instrcution on this.
Does anyone has an example for this.
Thanks in advance
****************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************