[SoapRMI] writing a (de)serializer

Aleksander Slominski aslom_at_cs.indiana.edu
Thu, 28 Nov 2002 16:09:28 -0500


"nodep_at_libero.it" wrote:

> Hi,
> I'm trying to write a (de)serializer for a
> class "Mex", but I've problem with the
> method "writeObject". It's like this:
> public void writeObject(
>         SerializeContext sctx,
>         EncodingStyle enc,
>         Object o,
>         String name,
>         Class baseClass,
>         String id)
>         throws SerializeException, XmlMapException, IOException
>     {
>         Writer out = sctx.getWriter();
>         out.write('<');
>         out.write(name);
>         SoapStyle style = sctx.getSoapStyle();
>         if(style.XSI_TYPED) sctx.writeXsdType("xmlMex");
>         out.write('>');
>
>         String s="TRY";
>         out.write(s);
>         out.write("</");
>         out.write(name);
>         out.write(">\n");
>     }
>
> ((it does nothing special but I want to see if it run...))

hi,

it looks OK.

> I've updated SoapEnc.java with:
> // handler for Mex
>         MexHandler mexHandler= new MexHandler();
>         SoapEnc.getDefault().registerClassEncodingHandler(
>         Mex.class,
>         mexHandler,
>         mexHandler);

you actually should call this from your class unless you want Mex
handler to be part of XSOAP.

> (("MexHandler" is my (de)serializer I placed in xsoap_1_2_19
> \src\java\soaprmi\soap\soaprmi\soapenc
>   with the new SoapEnc.java))
> After compilation (no error), I tried to send a "Mex"-object
> but nothing usefull was in the soap-message (i.e. the "TRY" string was
> not present), that is:
> <SOAP-ENV:Envelope xmlns:SOAP-
> ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-
> ENC='http://schemas.xmlsoap.org/soap/encoding/'
> xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
> xmlns:xsd='http://www.w3.org/1999/XMLSchema' SOAP-
> ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
>
> <SOAP-ENV:Body>
> <m:sayHello xmlns:m='urn:hello:sample'>
> <sayHello id='id1' xsi:type='ns1:minimal.Mex' xmlns:ns1='urn:soaprmi-
> v11:temp-java-xml-type'>
> </sayHello>
> </m:sayHello>
>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> Same result I have if I use an untouched xsoap_1_2_19.jar and I send
> a "Mex"-object.

how do you send your object and more importantly what exactly is Mex class?

if you send me Mex.java and MexHandler.java and your test class
i will try to reproduce the problem.

> PS-Now I'm able to compile xsoap because I use xsoap_1_2_19_all.zip
> instead of *.gzip (I don't know why...)

i have downloaded http://www.extreme.indiana.edu/xgws/xsoap/rmi/download/
xsoap_1_2_19_all.tgz and successfully recompiled on solaris and windows 2000
and rebuilt without any problems (on windows i have used WinZip to unpack .tgz)

i am still curious what is causing this problem for you.

thanks,

alek
--
The ancestor of every action is a thought. - Ralph Waldo Emerson