You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by MKW <m....@ru.ac.za> on 2005/04/06 01:37:57 UTC
string arrays as input parameters in in doc/literal services
Having now worked out how to send and receive arrays of user-defined
data types, I am stumped over how to send an array of strings as a
service call input parameter in a doc-literal/wrapped service.
My wsdl defines the array as following:
<xs:element name="returnMultiple">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="hw" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
(Here the element name is actually the method name.)
The method signature is:
public DictEntry[] returnMultiple(String[] hw) throws JAXRPCException;
In my client, I've tried:
call.addParameter("hw", org.apache.axis.encoding.XMLType.SOAP_ARRAY,
javax.xml.rpc.ParameterMode.IN);
I haven't used reference to serializers or deserializers in the Client -
do strings need them? And if they do (as arrays), arrays aren't beans,
so I'm not sure what to do. Do I need to define an ArrayType in my wsdl?
And create an ArrayType bean?
My WSDD has the lines:
<operation name="returnMultiple" qname="ns0.returnMultiple"
xmlns:ns0="http://dct/types" returnType="rtns:ArrayOf_ns0_DictEntry"
xmlns:rtns="http://dict/types" >
<parameter name="hw" type="xsd:ArrayOf_xsd_string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</operation>
plus I've tried adding (is this read when there is a ref to a wsdl file?):
<typeMapping
xmlns:ns="http://dct"
qname="ns:ArrayOf_xsd_string"
type="java:string[]"
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
I get a mile of exceptions but basically the message is:
Unable to deploy typemapping: {http://dct}ArrayOf_xsd_string
java.lang.ClassNotFoundException: [Lstring;....
and:
java.lang.ArrayStoreException: [Ljava.lang.String;..
(I don't know what an Lstring is - nor Ljava!) Help please someone.
Thanks.
Madeleine
Re: string arrays as input parameters in in doc/literal services
Posted by MKW <m....@ru.ac.za>.
Thanks. I did that and I'm sure you are right, but it hasn't fixed the
problem. I get the following:
java.lang.ArrayStoreException: [Ljava.lang.String;
I think there's something else that's wrong as well.
Madeleine
Venkat Reddy wrote:
> On Apr 6, 2005 5:07 AM, MKW <m....@ru.ac.za> wrote:
>
>>plus I've tried adding (is this read when there is a ref to a wsdl file?):
>><typeMapping
>> xmlns:ns="http://dct"
>> qname="ns:ArrayOf_xsd_string"
>> type="java:string[]"
>> serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
>> deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>>
>
> try changing the type to
> type="java:java.lang.String[]"
>
> - venkat
>
Re: string arrays as input parameters in in doc/literal services
Posted by Venkat Reddy <vr...@gmail.com>.
On Apr 6, 2005 5:07 AM, MKW <m....@ru.ac.za> wrote:
> plus I've tried adding (is this read when there is a ref to a wsdl file?):
> <typeMapping
> xmlns:ns="http://dct"
> qname="ns:ArrayOf_xsd_string"
> type="java:string[]"
> serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
> deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>
try changing the type to
type="java:java.lang.String[]"
- venkat