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 Paula Young <py...@invertix.com> on 2001/07/31 22:48:50 UTC

Having SOAP server return a Response object

In the soap api docs for the Response class, it says that both the client
and the server use Response objects to represent the result of a method
invocation.

I'm trying to have my server return a soap encoded response consisting of 4
string values.  And I tried to do this as a vector of params  in the
construction of my Response object.  My server code looks like:

  public Response Request(OrderEntry orderentry)
  {
    //  ...process the order entry here

    // build a good response:
    Vector params = new Vector();
    params.addElement(new Parameter("StatusCode", String.class, "0", null));
    params.addElement(new Parameter("OrderComment", String.class, "Payment
Due July 31, 2001", null));
    Response resp = new Response("urn:Result", "ReqStat", (Parameter) null,
params, (Header) null, 
            Constants.NS_URI_SOAP_ENC, null);
    return(resp);        
  }

This ends up getting an exception thrown on the Server side because there's
no serializer defined for the Response object return type:
Fault Code   = SOAP-ENV:Server
Fault String = java.lang.IllegalArgumentException: No Serializer found to
serialize a 'org.apache.soap.rpc.Response' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.

...is there a different style of encoding (besides
Constants.NS_URI_SOAP_ENC) that I need to specify?  Do I really need to
specify a serializer in the deployment descriptor?  I just want to easily
return 2 soap encoded string values.

Paula Young