You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by "Shang, Wencheng (Exchange)" <ws...@bear.com> on 2001/07/18 19:59:10 UTC

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.
***********************************************************************