Hi folks, newbie request for help coming up...
 
I am passing a byte array of data back to a client as a result of a call.
 
I am using classes generated by the JBuilder8 "Export as web service" menu.
 
Using the default code and files as generated works, but the data comes over as an array of numbers (see below)
 
<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body> 
         <ns1:getDocumentsForIDResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://server.soap.securicor.aps.co.uk">   
            <getDocumentsForIDReturn xsi:type="soapenc:Array" soapenc:arrayType="xsd:byte[243]" xmlns:ns2="null" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">   
               <item>120</item>   
               <item>-38</item>   
               <item>91</item>   
               <item>-13</item>   
               <item>-106</item>   
               <item>-127</item>   
               <item>-75</item>    
                  ...
                  ...
               <item>-72</item>   
            </getDocumentsForIDReturn> 
        </ns1:getDocumentsForIDResponse> 
     </soapenv:Body>
  </soapenv:Envelope>
 
Which means that for each byte in the byte array, I'm sending (on average) over 14 extra bytes!  This is, as you can imagine, very bad with larger data sets!
 
I'm sure I used to have the data coming over as a base64 encoded lump of text before moving to JB8...
 
Changing my wsdd file to use the Base64SerialisationFactory as shown below
 
  <typeMapping
    xmlns:ns="null"
    qname="ns:ArrayOffbyte"
    type="java:byte[]"
    serializer="org.apache.axis.encoding.ser.Base64SerializerFactory"
    deserializer="org.apache.axis.encoding.ser.Base64DeserializerFactory"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  />
does make the web service return the data as a base64 encoded lump... (see below)
 
<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body> 
         <ns1:getDocumentsForIDResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://server.soap.securicor.aps.co.uk">  
            <getDocumentsForIDReturn xsi:type="ns2:ArrayOffbyte" xmlns:ns2="null">eNpb85aBtbiIQbo0Wy85Xy+xoFivzEQvPykrNbmkWM8xINg3seAgt5l/ZMYpe2YGhooiBsGsxLJEvdKSzBw9j8TiDKA8K/utg4fFEi4yMzC5MXDl5CemuCUml+QXeTJwlmQUpRZn5OekVBTYOzCAgEA5B4gEYqYSBkZnIDYsYWByMSguZKhjYMRQxA6U9DYuYWCztDA0MbcAKncpYWA1MTAzNAHJAAl2QwMjAyMjUxDXqIRBytnRN8DJ1ccnWME9yN/ZNShSISDI3yXUOSQYpMKghIHZwByomDEAarU3kMMV7hjs4ennHuLvV1FRAQC9AkNk</getDocumentsForIDReturn> 
         </ns1:getDocumentsForIDResponse>
      </soapenv:Body>
   </soapenv:Envelope>
 
but now the client falls over with :-
 
AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.userException
 faultString: org.xml.sax.SAXException: Deserializing parameter 'getDocumentsForIDReturn':  could not find deserializer for type {null}ArrayOffbyte
 faultActor: null
 faultDetail:
 
 stackTrace: org.xml.sax.SAXException: Deserializing parameter 'getDocumentsForIDReturn':  could not find deserializer for type {null}ArrayOffbyte
 at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:276)
 at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:893)
 at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
 at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:684)
 at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:241)
 at org.apache.axis.message.RPCElement.getParams(RPCElement.java:265)
 at org.apache.axis.client.Call.invoke(Call.java:1871)
 at org.apache.axis.client.Call.invoke(Call.java:1777)
 at org.apache.axis.client.Call.invoke(Call.java:1315)
when trying to call my web service... (I'm watching the data via the tcp monitor program that comes with JBuilder)  I've forgotten to do somthing, but I can't figure out what... (I'm using the default code that the JBuilder wizard creates for me, with no changes...)  Could somebody point me in the right direction? (prefereably with little or no changes to the autogenerated files, as these get re-generated on a regular basis....)
 
Also, can I get this wizard to use the Base64 method by default, as I'm sure it used to in JB6 with the web services addon?
 
Thanks for your time folks..
 
/James.

Reply via email to