[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ksoap: Sending and receiving Elements


Stefan,

I tried to do that but  I got  : ClassCasting  error.
the soap envelope is that:

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
<SOAP-ENV:Body>
<ns1:getPhoneFromNameResponse
xmlns:ns1="urn:AddressFetcher"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<return xmlns:ns2="urn:xml-soap-address-demo"
xsi:type="ns2:phone">
<exchange xsi:type="xsd:string">456</exchange>
<areaCode xsi:type="xsd:int">123</areaCode>
<number xsi:type="xsd:string">7890</number>
</return>
</ns1:getPhoneFromNameResponse>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and my object is called Phone and it's implementing the kvmSerializable,
and to set the class map I do:

classMap.setMapping("urn:sml-soap-address-demo",,"the pakage"," and the instance
of Phone");

is it ok?
and I set the class map to the envelop.

I don't know if I sent you what you ask me...

thanks a lot.

montse



> Montse Farreras - Sun France - GSO - Stagiaire wrote:
> >
> > I've been following your discussion, I'm new on that, and I don't
> > undestand,.My problem is that I receive a SOAP response and the body is an
> > object, and I know which kind of object is it, I want to rebuild the object.
> > how I do?
>
> There are two possibilities: By default, kSOAP will
> generate SoapObjects from the response. If you
> want to have your own objects generated, you need
> to implement the KvmSerializable interface for
> these objects. You also need to register them with a
> DefaultClassMap. The DefaultClassMap holds the
> relations between XML names and namespaces and
> Java class names. The classmap must be registered
> with the SoapEnvelope.
>
> If you can send some example XML code, I can
> try to describe the process in more detail
> for your application.
>
> Best,
> Stefan
>
> --
> Stefan Haustein
> Univ. Dortmund, FB 4, LS 8   tel: +49 231 755 2499
> Baroper Str. 301             fax: +49 231 755 5105
> D-44221 Dortmund (Germany)   www-ai.cs.uni-dortmund.de
> _______________________________________________
> Ksoap mailing list
> Ksoap@enhydra.org
> http://www.enhydra.org/mailman/listinfo.cgi/ksoap