[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ksoap: ksoap and Base64 data


Hi,
	I have a problem that I seem cannot figure out a way around
with KSoap and Base64 data.

I can receive the Base64 data, and KSoap gives me a nice byte[] to work
with.  But I cannot seem to get KSoap to allow the client to send 
byte[] data back to the server.  Can anyone help with what I am 
doing wrong.

Here is what I am doing.

        transport = new HttpTransportSE( _URL, "myService" );
        transport.debug = true;

        // Set up mapping for not default class mapping.
        ClassMap classMap = new ClassMap( true );
        classMap.prefixMap = new PrefixMap( classMap.prefixMap, "ns",
"MyNameSpace" );
        classMap.addMapping( classMap.xsd, "base64Binary",
			     org.ksoap.marshal.MarshalBase64.class, 
			     new org.ksoap.marshal.MarshalBase64() );
        transport.setClassMap( classMap );

        // Get a SoapObject to fill in for the request.
        SoapObject request = new SoapObject( _serviceNameSpace,
"myService" );
        request.addProperty( "channel", new Integer( _channel ));
        request.addProperty( "device", new Integer( _device ));
        request.addProperty( "type", new Integer(ipctypes_programtype
));
        request.addProperty( "item", new Integer(number));
        request.addProperty( "data", data );  // data is a byte[]

I get the following exception:
	java.lang.RuntimeException: 
		Cannot serialize: [B@4ae2c1

					
        // Call the service. which returns a SoapObject 
	// which we can then get our response.
        SoapObject result = (SoapObject)transport.call( request );

        // Get the fields
        res = ((Integer)result.getProperty("result")).intValue();

-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+    Robert Morse                +              Be HAPPY              +
+    Welding Technology Corp     +          rmorse@medar.com          +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++