You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Matthew Duftler/Watson/IBM <du...@us.ibm.com> on 2000/09/07 19:29:03 UTC

Re: Serialize Array objects with Apache SOAP client

Try:

    params.addElement( new Parameter("MyArray" , a.getClass(), a , null ));

or:

    params.addElement( new Parameter("MyArray" , String[].class, a , null
));

Either one should work fine.

-Matt

"David A. Lee" <da...@calldei.com> on 09/07/2000 01:14:22 PM

Please respond to soap-dev@xml.apache.org

To:   <so...@xml.apache.org>
cc:
Subject:  Serialize Array objects with Apache SOAP client




Could anyone provide any hints on how to serialize and deserialize
Array objects using the Apache SOAP client ?
I found the "ArraySerializer" class but I cant figure out how to get
it to work.  None of the samples serialize arrays.

Sample code I've tried:

    String[]  a = new String[2];
    a[0] = "HI" ;
    a[1] = "There";

// Tried This
    params.addElement( new Parameter("MyArray" , Array.class, a , null ));

// Tried This
    params.addElement( new Parameter("MyArray" , ArraySerializer.class, a ,
null ));



Both produced runtime errors like this:

Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Client;msg=No
Ser
ializer found to serialize a 'java.lang.reflect.Array' using encoding style
'htt
p://schemas.xmlsoap.org/soap/encoding/'.;
targetException=java.lang.IllegalArgum
entException: No Serializer found to serialize a 'java.lang.reflect.Array'
using
 encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
        at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnec
tion.java:115)
        at org.apache.soap.rpc.Call.invoke(Call.java:145)
        at TestCommand.doOp(TestCommand.java:44)
        at TestCommand.main(TestCommand.java:80)


----------------------------
--------------------------------------------------
David A. Lee
Dal Enterprises Inc.
http://www.calldei.com

Could anyone provide any hints on how to serialize and deserialize
Array objects using the Apache SOAP client ?
I found the "ArraySerializer" class but I cant figure out how to get
it to work.  None of the samples serialize arrays.

Sample code I've tried:

    String[]  a = new String[2];
    a[0] = "HI" ;
    a[1] = "There";

// Tried This
    params.addElement( new Parameter("MyArray" , Array.class, a , null ));

// Tried This
    params.addElement( new Parameter("MyArray" , ArraySerializer.class, a ,
null ));



Both produced runtime errors like this:

Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Client;msg=No
Ser
ializer found to serialize a 'java.lang.reflect.Array' using encoding style
'htt
p://schemas.xmlsoap.org/soap/encoding/'.;
targetException=java.lang.IllegalArgum
entException: No Serializer found to serialize a 'java.lang.reflect.Array'
using
 encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
        at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnec
tion.java:115)
        at org.apache.soap.rpc.Call.invoke(Call.java:145)
        at TestCommand.doOp(TestCommand.java:44)
        at TestCommand.main(TestCommand.java:80)


----------------------------
--------------------------------------------------
David A. Lee
Dal Enterprises Inc.
http://www.calldei.com