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 Xingshan He <xi...@hotmail.com> on 2005/07/13 23:49:58 UTC

array of int (int[]) as input parameter in Axis 1.2.1 ?

I am trying to send a rpc request to server, with one of the parameters of
type int[].

 

The method's signature look like this:

    public String[] connect(Locale locale, SessionUser user, String
switchKey, int target, int[] slots) throws Exception;

 

Here is my arrayMapping entry in WSDD:

 

    <arrayMapping qname="ns:MyIntegerArray" xmlns:ns="urn:RadioSwitch"

             languageSpecificType="java:int[]"

                                     innerType="java:int"
xmlns:ns2="urn:RadioSwitch"

             encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

 

My client code is:

 

        call.setOperationName(new
QName("http://www.interop-solutions.com/paraclete/radioswitch", "connect"));

        call.addParameter( "arg1", new QName("urn:Locale", "Locale"),
ParameterMode.IN );

        call.addParameter( "arg2", new QName("urn:RadioSwitch",
"SessionUser"), ParameterMode.IN );

        call.addParameter( "arg3", XMLType.XSD_STRING, ParameterMode.IN );

        call.addParameter( "arg4", XMLType.XSD_INT, ParameterMode.IN );

        call.addParameter( "arg5", new QName("urn:RadioSwitch",
"MyIntegerArray"),

                           ParameterMode.IN );

        call.setReturnClass(String[].class);

 

        // Invoke the call.

        String[] resp = (String[])call.invoke(new Object[]{locale, user,
switchKey, new Integer(target), slots});

 

I am getting the following error.  It seems that Axis is not treating arg5
as an array, but as a single object.

 

java.lang.ClassNotFoundException: [Ljava/lang/Object;_Helper

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forName(Class.java:219)

        at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:178)

        at java.security.AccessController.doPrivileged(Native Method)

        at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)

        at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)

        at
org.apache.axis.utils.cache.MethodCache.getMethod(MethodCache.java:188)

        at
org.apache.axis.encoding.ser.BaseFactory.getMethod(BaseFactory.java:42)

        at
org.apache.axis.encoding.ser.BaseSerializerFactory.getGetSerializer(BaseSeri
alizerFactory.java:314)

        at
org.apache.axis.encoding.ser.BaseSerializerFactory.getSpecialized(BaseSerial
izerFactory.java:162)

        at
org.apache.axis.encoding.ser.BaseSerializerFactory.getSerializerAsInternal(B
aseSerializerFactory.java:91)

        at
org.apache.axis.encoding.ser.BaseSerializerFactory.getSerializerAs(BaseSeria
lizerFactory.java:82)

        at
org.apache.axis.encoding.SerializationContext.getSerializer(SerializationCon
text.java:1537)

        at
org.apache.axis.encoding.SerializationContext.serializeActual(SerializationC
ontext.java:1390)

        at
org.apache.axis.encoding.SerializationContext.serialize(SerializationContext
java:914)

        at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)

        at
org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)

        at
org.apache.axis.message.MessageElement.output(MessageElement.java:1208)

        at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)

        at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)

        at
org.apache.axis.message.MessageElement.output(MessageElement.java:1208)

        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)

 

Here is my generated wsdl:

 

   <complexType name="MyIntegerArray">

    <complexContent>

     <restriction base="soapenc:Array">

      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>

     </restriction>

    </complexContent>

   </complexType>

 

      <wsdl:operation name="connect" parameterOrder="locale user switchKey
target slots">

         <wsdl:input message="impl:connectRequest" name="connectRequest"/>

         <wsdl:output message="impl:connectResponse"
name="connectResponse"/>

      </wsdl:operation>

 

   <wsdl:message name="connectResponse">

      <wsdl:part name="connectReturn" type="impl:ArrayOf_xsd_string"/>

   </wsdl:message>

 

   <wsdl:message name="connectRequest">

      <wsdl:part name="locale" type="tns1:Locale"/>

      <wsdl:part name="user" type="tns2:SessionUser"/>

      <wsdl:part name="switchKey" type="soapenc:string"/>

      <wsdl:part name="target" type="xsd:int"/>

      <wsdl:part name="slots" type="tns2:MyIntegerArray"/>

   </wsdl:message>

 

Can anybody tell me what I did wrong?  I tried to search thru this list's
archive but so far have not found anything.

 

Thanks.

 

XS


RE: array of int (int[]) as input parameter in Axis 1.2.1 ?

Posted by Xingshan He <xi...@hotmail.com>.
I changed arg5 now to just taking in a int.  Still got the error but now 
this time the error is related to the return type of String[].

It seems to me the problem lies in using array of jave (primitive) type, 
like String[], or int[].

What would I need to do to use array of java types?  Anybody has any 
examples for this?

Thanks,
XS



>From: "Xingshan He" <xi...@hotmail.com>
>Reply-To: axis-user@ws.apache.org
>To: <ax...@ws.apache.org>
>Subject: array of int (int[]) as input parameter in Axis 1.2.1 ?
>Date: Wed, 13 Jul 2005 14:49:58 -0700
>MIME-Version: 1.0
>X-Originating-IP: [65.54.161.201]
>X-Originating-Email: [xingshan_he@hotmail.com]
>X-Sender: xingshan_he@hotmail.com
>Received: from mail.apache.org ([209.237.227.199]) by MC8-F4.hotmail.com 
>with Microsoft SMTPSVC(6.0.3790.211); Wed, 13 Jul 2005 14:50:14 -0700
>Received: (qmail 7410 invoked by uid 500); 13 Jul 2005 21:50:04 -0000
>Received: (qmail 7396 invoked by uid 99); 13 Jul 2005 21:50:04 -0000
>Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49)    by 
>apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2005 14:50:04 -0700
>Received: pass (asf.osuosl.org: domain of xingshan_he@hotmail.com 
>designates 65.54.161.77 as permitted sender)
>Received: from [65.54.161.77] (HELO hotmail.com) (65.54.161.77)    by 
>apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2005 14:50:01 -0700
>Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; 
>Wed, 13 Jul 2005 14:50:02 -0700
>Received: from 65.54.161.201 by BAY106-DAV5.phx.gbl with DAV;Wed, 13 Jul 
>2005 21:50:02 +0000
>X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPt4iogl2abg+M=
>Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm
>Precedence: bulk
>list-help: <ma...@ws.apache.org>
>list-unsubscribe: <ma...@ws.apache.org>
>List-Post: <ma...@ws.apache.org>
>List-Id: <axis-user.ws.apache.org>
>Delivered-To: mailing list axis-user@ws.apache.org
>X-ASF-Spam-Status: No, hits=1.7 
>required=10.0tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,HTML_MESSAGE,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS,SPF_PASS
>X-Spam-Check-By: apache.org
>X-Mailer: Microsoft Office Outlook, Build 11.0.6353
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
>Thread-Index: AcWH9NA6Qyeca+OlTBWbK8Vz3cyMeQ==
>X-OriginalArrivalTime: 13 Jul 2005 21:50:02.0681 (UTC) 
>FILETIME=[D2B58A90:01C587F4]
>X-Virus-Checked: Checked by ClamAV on apache.org
>Return-Path: axis-user-return-35023-xingshan_he=hotmail.com@ws.apache.org
>
>I am trying to send a rpc request to server, with one of the parameters of
>type int[].
>
>
>
>The method's signature look like this:
>
>     public String[] connect(Locale locale, SessionUser user, String
>switchKey, int target, int[] slots) throws Exception;
>
>
>
>Here is my arrayMapping entry in WSDD:
>
>
>
>     <arrayMapping qname="ns:MyIntegerArray" xmlns:ns="urn:RadioSwitch"
>
>              languageSpecificType="java:int[]"
>
>                                      innerType="java:int"
>xmlns:ns2="urn:RadioSwitch"
>
>              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>
>
>
>My client code is:
>
>
>
>         call.setOperationName(new
>QName("http://www.interop-solutions.com/paraclete/radioswitch", 
>"connect"));
>
>         call.addParameter( "arg1", new QName("urn:Locale", "Locale"),
>ParameterMode.IN );
>
>         call.addParameter( "arg2", new QName("urn:RadioSwitch",
>"SessionUser"), ParameterMode.IN );
>
>         call.addParameter( "arg3", XMLType.XSD_STRING, ParameterMode.IN );
>
>         call.addParameter( "arg4", XMLType.XSD_INT, ParameterMode.IN );
>
>         call.addParameter( "arg5", new QName("urn:RadioSwitch",
>"MyIntegerArray"),
>
>                            ParameterMode.IN );
>
>         call.setReturnClass(String[].class);
>
>
>
>         // Invoke the call.
>
>         String[] resp = (String[])call.invoke(new Object[]{locale, user,
>switchKey, new Integer(target), slots});
>
>
>
>I am getting the following error.  It seems that Axis is not treating arg5
>as an array, but as a single object.
>
>
>
>java.lang.ClassNotFoundException: [Ljava/lang/Object;_Helper
>
>         at java.lang.Class.forName0(Native Method)
>
>         at java.lang.Class.forName(Class.java:219)
>
>         at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:178)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>
>         at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
>
>         at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
>
>         at
>org.apache.axis.utils.cache.MethodCache.getMethod(MethodCache.java:188)
>
>         at
>org.apache.axis.encoding.ser.BaseFactory.getMethod(BaseFactory.java:42)
>
>         at
>org.apache.axis.encoding.ser.BaseSerializerFactory.getGetSerializer(BaseSeri
>alizerFactory.java:314)
>
>         at
>org.apache.axis.encoding.ser.BaseSerializerFactory.getSpecialized(BaseSerial
>izerFactory.java:162)
>
>         at
>org.apache.axis.encoding.ser.BaseSerializerFactory.getSerializerAsInternal(B
>aseSerializerFactory.java:91)
>
>         at
>org.apache.axis.encoding.ser.BaseSerializerFactory.getSerializerAs(BaseSeria
>lizerFactory.java:82)
>
>         at
>org.apache.axis.encoding.SerializationContext.getSerializer(SerializationCon
>text.java:1537)
>
>         at
>org.apache.axis.encoding.SerializationContext.serializeActual(SerializationC
>ontext.java:1390)
>
>         at
>org.apache.axis.encoding.SerializationContext.serialize(SerializationContext
>java:914)
>
>         at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
>
>         at
>org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
>
>         at
>org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
>
>         at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
>
>         at
>org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
>
>         at
>org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
>
>         at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
>
>
>
>Here is my generated wsdl:
>
>
>
>    <complexType name="MyIntegerArray">
>
>     <complexContent>
>
>      <restriction base="soapenc:Array">
>
>       <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
>
>      </restriction>
>
>     </complexContent>
>
>    </complexType>
>
>
>
>       <wsdl:operation name="connect" parameterOrder="locale user switchKey
>target slots">
>
>          <wsdl:input message="impl:connectRequest" name="connectRequest"/>
>
>          <wsdl:output message="impl:connectResponse"
>name="connectResponse"/>
>
>       </wsdl:operation>
>
>
>
>    <wsdl:message name="connectResponse">
>
>       <wsdl:part name="connectReturn" type="impl:ArrayOf_xsd_string"/>
>
>    </wsdl:message>
>
>
>
>    <wsdl:message name="connectRequest">
>
>       <wsdl:part name="locale" type="tns1:Locale"/>
>
>       <wsdl:part name="user" type="tns2:SessionUser"/>
>
>       <wsdl:part name="switchKey" type="soapenc:string"/>
>
>       <wsdl:part name="target" type="xsd:int"/>
>
>       <wsdl:part name="slots" type="tns2:MyIntegerArray"/>
>
>    </wsdl:message>
>
>
>
>Can anybody tell me what I did wrong?  I tried to search thru this list's
>archive but so far have not found anything.
>
>
>
>Thanks.
>
>
>
>XS
>