Re: Ksoap: Re: Ksoap: Parameters

[email protected] Fri, 12 Sep 2003 09:46:13 +0200
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
If your server returns a soap array of objects, you can get it
with something similar (here using kSoap1.2, should be
similar using kSoap 2) :

Reader soapReader = null;
try
{
    soapReader = // send your soap request and wait for the response stream

    XmlParser xp = new XmlParser(soapReader);
    responseEnvelope.parse(xp);

    // check if the response is a soap fault ...
    if(responseEnvelope.getBody() instanceof SoapFault)
    {
        throw ((SoapFault)responseEnvelope.getBody());
    }

    // As we use a RPC-like service, we expect only 1 object as a response
(might be a wrapper !)
    SoapObject response = (SoapObject)responseEnvelope.getBody();
    // the response must be a soap array. kSoap unmarshal soap arrays into
java Vectors
    Vector vector =  response.getProperty(0);

    }
    finally
    {
      if (soapReader != null) try {soapReader.close();} catch (Exception ex)
{}
    }

Hope it helps,
Sebastien.

----- Original Message -----
From: "Sati Hillyer" <[email protected]>
To: <[email protected]>
Sent: Thursday, September 11, 2003 7:57 PM
Subject: Re: Ksoap: Re: Ksoap: Parameters


> I want my result to be an array of objects, what is the correct command to
> access this. Then, I will be able to parse the array and remove the
elements
> I need.
>
> Thanks,
> Sati
>
> On 9/10/03 1:13 AM, "[email protected]"
> <[email protected]> wrote:
>
> > Yes you can.
> >
> > In an RPC style request, the result is zero or one object.
> >
> > This object can be array of objects, or a complex object
> > wrapping whatever you want.
> >
> > In one of my application, I use kSoap to return a pretty
> > complex object that can be up to 10 MB when serialized
> > in XML !
> >
> > Regards,
> > Sebastien.
> >
> > ----- Original Message -----
> > From: "Sati Hillyer" <[email protected]>
> > To: <[email protected]>
> > Sent: Wednesday, September 10, 2003 2:50 AM
> > Subject: Ksoap: Parameters
> >
> >
> >> Can kSOAP handle receiving multiple parameters at one time? For
instance,
> >> receiving 3 or 4 strings in one transmission. I can send multiple
strings
> >> and vectors with no problem, but I need to receive as well. Please let
me
> >> know if this capability is available.
> >>
> >> Thanks in advance,
> >> Sati
> >>
> >> _______________________________________________
> >> Ksoap mailing list
> >> [email protected]
> >> http://www.enhydra.org/mailman/listinfo.cgi/ksoap
> >>
> >>
> >
> >
> >
> >
> > _______________________________________________
> > Ksoap mailing list
> > [email protected]
> > http://www.enhydra.org/mailman/listinfo.cgi/ksoap
> >
>
> _______________________________________________
> Ksoap mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/ksoap
>