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 Cédric Chabanois <CC...@cognicase.fr> on 2001/12/11 10:14:02 UTC

TR: SOAP arrays

> Hi !
> 
> Some questions concerning SOAP arrays with Axis :
> 
> I have a file named Essai.jws
> 
> public class Essai {
>   public int add(int i1[], int i2)
>   {
>     return i1[0] + i2; 
>   }
> }
> 
> 1) It seems that there is no way to tell the wsdl generator what is the
> size of the array.
> 
> When I try http://localhost:8080/axis/Essai.jws?wsdl
> <message name="addRequest"> 
> <part name="arg0" type="ns1:Array" /> 
> <part name="arg1" type="xsd:int" /> 
> </message>
> 
> 2) So the wsdl does not tell us that this is an array of int (is this to
> be fixed ?).
> 
> 
> When I use java -classpath
> axis.jar;clutil.jar;wsdl4j.jar;log4j-gump.jar;xerces.jar
> org.apache.axis.wsdl.Wsdl2java -s Essai.wsdl,
> EssaiSoapBindingImpl is as follow (Essai.wsdl is the file corresponding to
> Essai.jws?wsdl) :
> "
> package localhost;
> 
> public class EssaiSoapBindingImpl implements localhost.EssaiPortType {
>     public int add(Object[] arg0, int arg1) throws
> java.rmi.RemoteException {
>         return -3;
>     }
>     public int subtract(int arg0, int arg1) throws
> java.rmi.RemoteException {
>         return -3;
>     }
> }
> "
> 
> When I modify Essai.wsdl so that arg0 is in/out :
>   <message name="addRequest">
>     <part name="arg0" type="ns1:Array"/>
>     <part name="arg1" type="xsd:int"/>
>   </message>
>   <message name="addResponse">
>     <part name="addResult" type="xsd:int"/>
>     <part name="arg0" type="ns1:Array"/>
>   </message>
> 
> 3) EssaiSoapBindingImpl becomes :
> public class EssaiSoapBindingImpl implements localhost.EssaiPortType {
>     public int add(Object[]Holder arg0, int arg1) throws
> java.rmi.RemoteException {
>         return -3;
>     }
>     public int subtract(int arg0, int arg1) throws
> java.rmi.RemoteException {
>         return -3;
>     }
> }
> 
> and EssaiSoapBindingSkeleton is also quite strange :
> 
>     public Object add(Object[] arg0, int arg1) throws
> java.rmi.RemoteException
>     {
>         Object[]Holder arg0Holder = new Object[]Holder(arg0);
>         Object ret = new Integer(impl.add(arg0Holder, arg1));
>         org.apache.axis.server.ParamList list = new
> org.apache.axis.server.ParamList();
>         list.add(new org.apache.axis.message.RPCParam("addResult", ret));
>         list.add(new org.apache.axis.message.RPCParam("arg0",
> arg0Holder._value));
>         return list;
>     }
> 
> 
> I modified the wsdl (another one)  so that I have a function with an array
> of int as parameter
> 
> public float calculate(int[] arg0) throws java.rmi.RemoteException {
>         return -3;
>     }
> 
> The function is correctly generated (with Wsdl2java)
> 
> 
> 4) But when I put the array of int as an in/out parameter :
> 
> public float calculate(int[]Holder arg0) throws java.rmi.RemoteException {
>         return -3;
>     }
> 
> 
> Cédric