2 Replies Latest reply on Jul 8, 2005 5:40 PM by moebus

    problem serialize byte[] property as base64Binary

    moebus

      Have set up web service in JBoss 4.0.2 of type document/literal,
      the argument of my method is a user defined type which contains a field of type byte[].

      class DataDTO() {
       public byte[] data;
      }


      the wsdl (generated with wscompile as recommended) contains the schema for this and looks as follows:
      <complexType name="DataDTO">
       <sequence>
       <element name="data" type="base64Binary" nillable="true" />
       </sequence>
      </complexType


      To my understanding this should define that the byte array is converted to a base64 encoded string on the wire, and converted back on receiving side. I have no custom serializers or other stuff.

      When this DataDTO structure is used as return value, JBoss returns on the wire
      <result>
       <data>5</data>
       <data>7</data>
      </result>
      i.e. for every single byte a data tag is transmitted. This is then not understood by a .NET client set up after the generated wsdl.

      On the contrary when .NET invokes such web service and has a DataDTO as argument, it correctly sends
      <argument1>
      <data>AQIDBAU=</data>
      </argument1>

      but JBoss evidently insists on something like it has sent, therefore thinks that AQIDBAU= is the decimal reprecentation of a single byte in the data array and encounters a NumberFormatException, with following stack trace:
      Integer.parseInt(String, int) line: 468
      Byte.parseByte(String, int) line: 122
      Byte.<init>(String) line: 296
      NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not available [native method]
      NativeConstructorAccessorImpl.newInstance(Object[]) line: 39
      DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 27
      Constructor.newInstance(Object[]) line: 274
      SimpleDeserializer.makeValue(String) line: 325
      SimpleDeserializer.onEndElement(String, String, DeserializationContext) line: 236
      SimpleDeserializer(DeserializerImpl).endElement(String, String, DeserializationContext) line: 582
      DeserializationContextImpl.endElement(String, String, String) line: 1249
      SAX2EventRecorder.replay(int, int, ContentHandler) line: 252
      RPCElement(SOAPElementAxisImpl).publishToHandler(ContentHandler) line: 1386
      RPCElement.deserialize() line: 262
      RPCElement.getParams() line: 396
      JBossRPCInvocation(RPCInvocation).prepareFromRequestEnvelope() line: 235
      InvokerProviderEJB(RPCProvider).processMessage(MessageContext, SOAPEnvelopeAxisImpl, SOAPEnvelopeAxisImpl, Object) line: 103
      InvokerProviderEJB(JavaProvider).invoke(MessageContext) line: 358
      InvocationStrategy.visit(Handler, MessageContext) line: 73
      SOAPService(SimpleChain).doVisiting(MessageContext, HandlerIterationStrategy) line: 160
      SOAPService(SimpleChain).invoke(MessageContext) line: 123
      SOAPService.invoke(MessageContext) line: 560
      ServerEngine.invokeInternal(MessageContext) line: 200
      ServerEngine.invoke(MessageContext) line: 89
      

      Did I make something wrong here,
      or is byte[] not correctly supported in this circumstances?