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 Steeve Gilbert <St...@canammanac.com> on 2001/08/01 14:55:30 UTC

Re: Having SOAP server return a Response object

Try using a String array.  Something like...

 public String[] Request(OrderEntry orderentry)
  {
    String[] sa = new String[4];
    sa[1] = "String1";
    sa[2] = "String2";
    sa[3] = "String3";
    sa[4] = "String4";
    return(sa);
  }

By the way, method exposed by your server doesn't need (and are not made
to) return a Response object.  You have to return type that have a
serializer like String, Double, Integer...  and their arrays.

Good luck!

Steeve...




"Paula Young" <py...@invertix.com> on 31/07/2001 04:48:50 PM

Please respond to soap-user@xml.apache.org

To:   "Soap-User" <so...@xml.apache.org>
cc:    (bcc: Steeve Gilbert/G_STGEORGES/CANAM_MANAC)

Subject:  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

(See attached file: winmail.dat)





RE: Having SOAP server return a Response object

Posted by Paula Young <py...@invertix.com>.
Thanks, guess I read the Response class api doc page wrong.

Do you know if there's anyway to get a tagname wrapper around each string?,
like sa1 and sa2 here:
> 		<sa1 xsi:type="xsd:string">String1value</sa1>
> 		<sa2 xsi:type="xsd:string">String2value</sa2>

Thanks for your help!
Paula

 -----Original Message-----
From: 	Steeve Gilbert [mailto:Steeve_Gilbert@canammanac.com]
Sent:	Wednesday, August 01, 2001 8:56 AM
To:	soap-user@xml.apache.org
Subject:	Re: Having SOAP server return a Response object

 << File: winmail.dat >>
Try using a String array.  Something like...

 public String[] Request(OrderEntry orderentry)
  {
    String[] sa = new String[4];
    sa[1] = "String1";
    sa[2] = "String2";
    sa[3] = "String3";
    sa[4] = "String4";
    return(sa);
  }

By the way, method exposed by your server doesn't need (and are not made
to) return a Response object.  You have to return type that have a
serializer like String, Double, Integer...  and their arrays.

Good luck!

Steeve...




"Paula Young" <py...@invertix.com> on 31/07/2001 04:48:50 PM

Please respond to soap-user@xml.apache.org

To:   "Soap-User" <so...@xml.apache.org>
cc:    (bcc: Steeve Gilbert/G_STGEORGES/CANAM_MANAC)

Subject:  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

(See attached file: winmail.dat)






RE: Having SOAP server return a Response object

Posted by Paula Young <py...@invertix.com>.
Thanks, guess I read the Response class api doc page wrong.

Do you know if there's anyway to get a tagname wrapper around each string?,
like sa1 and sa2 here:
> 		<sa1 xsi:type="xsd:string">String1value</sa1>
> 		<sa2 xsi:type="xsd:string">String2value</sa2>

Thanks for your help!
Paula

 -----Original Message-----
From: 	Steeve Gilbert [mailto:Steeve_Gilbert@canammanac.com]
Sent:	Wednesday, August 01, 2001 8:56 AM
To:	soap-user@xml.apache.org
Subject:	Re: Having SOAP server return a Response object

 << File: winmail.dat >>
Try using a String array.  Something like...

 public String[] Request(OrderEntry orderentry)
  {
    String[] sa = new String[4];
    sa[1] = "String1";
    sa[2] = "String2";
    sa[3] = "String3";
    sa[4] = "String4";
    return(sa);
  }

By the way, method exposed by your server doesn't need (and are not made
to) return a Response object.  You have to return type that have a
serializer like String, Double, Integer...  and their arrays.

Good luck!

Steeve...




"Paula Young" <py...@invertix.com> on 31/07/2001 04:48:50 PM

Please respond to soap-user@xml.apache.org

To:   "Soap-User" <so...@xml.apache.org>
cc:    (bcc: Steeve Gilbert/G_STGEORGES/CANAM_MANAC)

Subject:  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

(See attached file: winmail.dat)