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 "David A. Lee" <da...@calldei.com> on 2000/09/07 19:14:22 UTC

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