ws-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steeve Gilbert" <Steeve_Gilb...@canammanac.com>
Subject RE: Having SOAP server return a Response object
Date Wed, 01 Aug 2001 13:38:33 GMT


>Thanks, guess I read the Response class api doc page wrong.

Not really.  It's just that the Response object is create automatically by
Apache Soap, it's not your job to build it.  Like it's not your job to
build the entire soap message.

Ok...  I think you see SOAP more complicated then it really is.  Can you
show us your client code?  You're server should look like this and nothing
more except other method if you have some.  But OrderEntry won't pass thru
the soap I think.

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

You don't have to wrap everything, the Apache soap take care of this.
Check this client sample...
http://www.xmethods.net/download/servicefiles/TempClient.java

Steeve...




"Paula Young" <pyoung@invertix.com> on 01/08/2001 09:16:54 AM

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

To:   <soap-user@xml.apache.org>
cc:    (bcc: Steeve Gilbert/G_STGEORGES/CANAM_MANAC)

Subject:  RE: Having SOAP server return a Response object


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" <pyoung@invertix.com> on 31/07/2001 04:48:50 PM

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

To:   "Soap-User" <soap-user@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)












Mime
View raw message