3 Replies Latest reply: Dec 1, 2010 7:00 PM by 803272 RSS

    How recovery string from array bytes from a Web Service

    803272
      Hi All

      I know the String variables are serialible. However I am trying to convert a String varible to array bytes and send it by using a Web Service. This Web Service is used by application J2ME, when I trying to convert the array bytes to String and recovering the initial value of the string variable, this error shows:

      Expected Byte, received: Vlc0Z2MyRnNkV1J2

      In the console of J2ME application.

      The code of the Web Method is

      *@WebMethod(operationName = "retornarBytes")*
      *public byte[] retornarBytes() {*
      *//TODO write your implementation code here:*
      String mensaje="Un saludo";

      return mensaje.getBytes();
      *}*     
           
      The Web SErvice Client in Application J2ME, is generated by Netbeans (6.7.1) and the code to calling the Web Service from application J2ME is:

      try
      *{*
      *     PruebaWSService_Stub ws=new PruebaWSService_Stub();*
      *     byte[] bytes=ws.retornarBytes();*
      *}*
      catch(IOException ex)
      *{*
      *     System.out.println(ex.getMessage());*
      *}*
      I hope you can help me. Thanks a lot

      Edited by: 800269 on 5/10/2010 01:52 PM