You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Simon Fell <so...@zaks.demon.co.uk> on 2000/08/13 19:55:04 UTC

Uisng the base64 serializer

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

Re: Uisng the base64 serializer

Posted by Jeff MAURY <jf...@scort.com>.

Simon Fell wrote:
> 
> so, is no one else seeing this problem ?
Hello,

I used the base64 encoder in another context. I have met several
problems so I think there are some mistakes. I will try to recover my
changes and publish them.

Jeff

> 
> Cheers
> Simon
> 
> On Sun, 13 Aug 2000 11:13:48 -0700, in soap you wrote:
> 
> >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

-- 
Jeff MAURY
SCORT CTO


 #####   #####  ####### ######  #######
#     # #     # #     # #     #    #
#       #       #     # #     #    #
 #####  #       #     # ######     #
      # #       #     # #   #      #
#     # #     # #     # #    #     #
 #####   #####  ####### #     #    #
                                                      
  Extending the net to the mainframe
  ==================================

Re: Uisng the base64 serializer

Posted by Jeff MAURY <jf...@scort.com>.

Simon Fell wrote:
> 
> so, is no one else seeing this problem ?
Hello,

I used the base64 encoder in another context. I have met several
problems so I think there are some mistakes. I will try to recover my
changes and publish them.

Jeff

> 
> Cheers
> Simon
> 
> On Sun, 13 Aug 2000 11:13:48 -0700, in soap you wrote:
> 
> >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

-- 
Jeff MAURY
SCORT CTO


 #####   #####  ####### ######  #######
#     # #     # #     # #     #    #
#       #       #     # #     #    #
 #####  #       #     # ######     #
      # #       #     # #   #      #
#     # #     # #     # #    #     #
 #####   #####  ####### #     #    #
                                                      
  Extending the net to the mainframe
  ==================================

Re: Uisng the base64 serializer

Posted by Simon Fell <so...@zaks.demon.co.uk>.
so, is no one else seeing this problem ?

Cheers
Simon

On Sun, 13 Aug 2000 11:13:48 -0700, in soap you wrote:

>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


Re: Uisng the base64 serializer

Posted by Simon Fell <so...@zaks.demon.co.uk>.
so, is no one else seeing this problem ?

Cheers
Simon

On Sun, 13 Aug 2000 11:13:48 -0700, in soap you wrote:

>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


Re: Uisng the base64 serializer

Posted by Simon Fell <so...@zaks.demon.co.uk>.
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


Re: Uisng the base64 serializer

Posted by Simon Fell <so...@zaks.demon.co.uk>.
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