Thanks for the reply.

I can do something similar to the below but my POJO's maybe quite
complicated. I was hoping for someway in J2ME to get some library that
will marshall and unmarshall my POJO's for me, much like Hessian does
for you when using the factory object in J2SE. For example I could use
XStream but I am trying to avoid the java to xml and xml to java since
in my experience it is quite time consuming.

Cheers
Paul

-----Original Message-----
From: Fábio Pinheiro [mailto:[EMAIL PROTECTED] 
Sent: 10 October 2007 13:50
To: Paul French
Cc: [email protected]
Subject: Resp.: [Hessian-interest] How to run Hessian on j2me personal
profile 1.1

Hi Paul.
The ObjectFactory does not exist in J2ME.

I use this implementation, and work fine, sample:

                // Call web Service Hessian
                String url
="http://192.168.0.101:8080/br.com.exemplo.WebService/test ";

                HttpConnection      c = (HttpConnection)
Connector.open(url);
                c.setRequestMethod(HttpConnection.POST);

                OutputStream        os = c.openOutputStream();
                MicroHessianOutput  out = new MicroHessianOutput(os);

                out.startCall("downloadProdutos");

                out.completeCall();
                os.flush();

                // Begining read return
                InputStream is = c.openInputStream();

                MicroHessianInput in = new MicroHessianInput(is);
                in.startReply();

                // Get return JSON from Hessian
                String respJSON = in.readString();

                // Close Web Service read
                in.completeReply();

I read this tutotial (in the end of page):
http://www.caucho.com/resin-3.0/protocols/hessian.xtp

For return a simple String, or int or byte[], all work fine. But if
you try return a List of TO (POJO), you will problem when try
deserialize List of objects in J2ME.

I resolve this problem with JSON. I transform my List of object in a
JSONArray.toString(), and later I can parse ans deserialize this List
in my J2ME.

See the sample in:
http://maillist.caucho.com/pipermail/hessian-interest/2007-October/00014
8.html

thanks,
Fabio Pinheiro - Brasil

2007/10/10, Paul French <[EMAIL PROTECTED]>:
> Hello all,
>
> The Hessian protocol is exactly what we require to support
communication
> between mobile devices running (J2ME personal profile 1.1) and our
> application servers running J2EE
>
> We have a Hessian Servlet running on the J2EE application server with
no
> problems. Hessian clients can talk to this with no problem when using
> J2SE
>
> However using J2ME personal profile 1.1 Hessian clients do not work
> since they rely on optional packages not in J2ME personal profile 1.1
>
> The error I get is java.lang.NoClassDefFoundError:
> javax.naming.spi.ObjectFactory
>
> Anyone have any ideas how I can get round this problem since we would
> really like to use Hessian on our remote mobile devices.
>
>
> Best Regards
> Paul
>
>

__________ NOD32 2584 (20071010) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com




_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to