You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Dmitry Solodovnik <so...@dmytro.com> on 2000/09/02 15:28:17 UTC

Problrm with Fault in Apache-SOAP

Hi!

    I'm working on developing same Server side SOAP application. I get
exception while marshalling Body with Fault element.
This is simple code I'm trying to get to work:
....
 Envelope env = new Envelope();
 env.declareNamespace( Constants.NS_PRE_SOAP_ENC, Constants.NS_URI_SOAP_ENC);
 env.setAttribute(new QName( Constants.NS_URI_SOAP_ENV ,
Constants.ATTR_ENCODING_STYLE),
                  Constants.NS_URI_SOAP_ENC);
 Body body = new Body();
 Vector bodyEntries = new Vector();
 Fault fault= new Fault();
 fault.setFaultCode(errorCode);
 fault.setFaultString(reasonPhrase);

 bodyEntries.addElement(new Bean(Fault.class,fault));
 body.setBodyEntries(bodyEntries);
 env.setBody(body);
 StringWriter payloadSW = new StringWriter ();
 env.marshall (payloadSW, smr);
....

Exception is:
 java.lang.IllegalArgumentException: Body entries must implement the Serializer
interface.
        at org.apache.soap.Body.marshall(Body.java:151)
        at org.apache.soap.Envelope.marshall(Envelope.java:180)

So, this is a bug that Fault class doesn't implements Serializer or I did
something wrong ?

Thanks for any answers,
Dmitry.