xml-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Fell <s...@zaks.demon.co.uk>
Subject Re: Uisng the base64 serializer
Date Sun, 13 Aug 2000 18:13:48 GMT
ok, i've got a bit further, but now i get an exception in
Base64.encode

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
        at org.apache.xerces.utils.Base64.encode(Base64.java:177)
        at
org.apache.soap.encoding.soapenc.Base64Serializer.marshall(Base64Serializer.java:38)
        at
org.apache.soap.encoding.soapenc.ParameterSerializer.marshall(ParameterSerializer.java:100)
        at
org.apache.soap.rpc.RPCMessage.serializeParams(RPCMessage.java:335)
        at
org.apache.soap.rpc.RPCMessage.marshall(RPCMessage.java:305)
        at org.apache.soap.Body.marshall(Body.java:141)
        at org.apache.soap.Envelope.marshall(Envelope.java:180)
        at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:100)
        at org.apache.soap.rpc.Call.invoke(Call.java:145)
        at
interop_tests.apacheSoap.testBase64.main(testBase64.java:53)

and here's my code

    byte items[] = new byte[512] ;
    for ( int i = 0 ; i < 512 ; ++i )
    {
		items[i] = (byte)(i % 256) ;
    }

    // register the base64 serializer 
    SOAPMappingRegistry smr = new SOAPMappingRegistry();
    Base64Serializer Ser = new Base64Serializer();
    smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                 new QName("SOAP-ENC", "base64"),
                 byte[].class, Ser, Ser);

    // Build the call.
    Call call = new Call ();
    call.setSOAPMappingRegistry(smr);
    call.setTargetObjectURI ("http://simon.fell.com/trickyTypes");
    call.setMethodName ("image_match");
    call.setEncodingStyleURI(encodingStyleURI);
    Vector params = new Vector ();
    params.addElement (new Parameter("imageData", byte[].class, items,
null));
    call.setParams (params);


This is using Apache SOAP 2.0 rc2 & Xerces-J 1.1.3

Cheers
Simon

On Sun, 13 Aug 2000 10:55:04 -0700, in soap you wrote:

>I'm trying to use the base64Serializer to encode a byte array,
>currently the generated output is 
>
><SOAP-ENV:Envelope
>xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
>xmlns:xsd="http://www.w3.org/1999/XMLSchema">
><SOAP-ENV:Body>
><ns1:image_match xmlns:ns1="http://simon.fell.com/trickyTypes"
>SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
><imageData xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/"
>xsi:type="ns2:Array" ns2:arrayType="xsd:byte[512]">
><item xsi:type="xsd:byte">0</item>
><item xsi:type="xsd:byte">1</item>
><item xsi:type="xsd:byte">2</item>
>... etc
>
>
>Looking in SOAPMappingRegistry it doesn't appear to know about the
>base64Serializer, how do i register the base64Serializer at runtime ?
>
>Thanks
>Simon


Mime
View raw message