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?

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
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to