logo       

Re: Please - MicroHessianInput - readObject(null) - problem deserialization: msg#00001

Subject: Re: Please - MicroHessianInput - readObject(null) - problem deserialization (1 week)
On Oct 1, 2007, at 9:39 AM, Fábio Pinheiro wrote:

> Hi,
> I can't resolve this problem.
>
> In my client application (J2ME - CDC), I can get the return when is a
> String or a int. But, i get the a object (TO sample, as Product). The
> return is a byte[] (array).
>
> How can I serialize again in my object?

You need to use the MicroHessian on both sides of the connection.

Also, if you're using "startReply" on the client, you need to use  
"startReply" on the server.  The two sides need to match.

-- Scott

>
> Server code:
> public byte[] returnTO() throws Exception {
>         ByteArrayOutputStream bos = new ByteArrayOutputStream();
>         Hessian2Output out = new Hessian2Output(bos);
>
>         out.startMessage();
>
>         ProdutoTO prod = new ProdutoTO();
>         prod.setCodigo(1);
>         prod.setDescricao("prod palhaco");
>
>         out.completeMessage();
>
>         out.close();
>
>         return bos.toByteArray();
> }
>
> Client (J2me - CDC):
>             String url =
> "http://localhost:8084/br.com.rosaFlores.WebService/test";;
>             HttpConnection      c = (HttpConnection) Connector.open 
> (url);
>
>             c.setRequestMethod(HttpConnection.POST);
>
>             OutputStream        os = c.openOutputStream();
>             MicroHessianOutput  out = new MicroHessianOutput(os);
>
>             out.startCall("returnTO");
>
>             out.completeCall();
>
>             os.flush();
>
>             InputStream is = c.openInputStream();
>             MicroHessianInput in = new MicroHessianInput(is);
>
>             in.startReply();
>
>
>             //int total = in.readInt();
>             //String ok = in.readString();
>
>             Object obj = in.readObject(null);
>
> ------------
>
> If I ask the instanceof the obj, is a array byte (byte[]).
> i can't make a cast for my object, teturn error.
>
> How can I cast (or serialize) this object in my TO?
>
> Please, this is the 3º post about this problem.
>
> If anybody can use hessian (return a List of TO [POJO]), please...
>
> thanks,
> Fabio
>
>
> _______________________________________________
> hessian-interest mailing list
> hessian-interest-p4ZHcaHNc0TQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> http://maillist.caucho.com/mailman/listinfo/hessian-interest


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.drivers.b...    security.firewa...    mathematics.lps...    web.zope.plone....    x25/2005-12/msg...    culture.tv.sout...    pld.user.polish...    qplus.devel/200...    version-control...    openbsd.bugs/20...    distributions.g...    gnu.chess.bugs/...    redhat.release....    emacs.bugs/2002...    java.bio.genera...    ataraid/2005-01...    finance.moneyda...    hardware.microc...    netbsd.ports.xe...    bug-tracking.gn...    text.xml.saxon....    kde.linux/2002-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo