axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Lau" <alau9...@hotmail.com>
Subject in/out parameters cause Axis exception
Date Thu, 24 Jul 2003 20:45:28 GMT
Hi,

I have a problem making a webservice to accept in/out parameters.

Here is what I did(I am not sure if my steps are correct):

I first created an interface for my webservice:

----------------------------
package AxisTest2;

public interface IAxisTest {
    void Add(int a, int b, Arg1 arg1, Arg2 arg2);

    void Sub(int a, int b, Arg1 arg1, Arg2 arg2);
}
----------------------------

I then compile that interface and write an ant task to generate the WSDL 
file, the ant task looks like this:

--------------------------
    <target name="java2wsdl">
      <java2wsdl bindingname="AxisTest2Class"
          classname="AxisTest2.IAxisTest"
          location="${deployedwebservicelocation}"
          namespace="${deployedwebservicelocation}"
          namespaceimpl="http://IAxisTest"
          porttypename="IAxisTest2"
          serviceelementname="${deployedwebservicename}"
          serviceportname="${deployedwebservicename}"
          style="RPC"
          output="IAxisTestService.wsdl"
          stopclasses="javax.xml.rpc.holders.Holder">
          <classpath>
              <path refid="classpath"/>
          </classpath>
      </java2wsdl>
    </target>
--------------------------

I found that the result wsdl file assumes all parameters are 'in' 
parameters(there is no way to tell java2wsdl which arguments should be 
'in/out'). So I modify the wsdl file manually as follows(I add all the 
'part' elements to the response message, so to make them 'in/out' 
parameters):

---------------------------
   <wsdl:message name="SubResponse">

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

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

       <wsdl:part name="in2" type="tns1:Arg1"/>

       <wsdl:part name="in3" type="tns1:Arg2"/>

   </wsdl:message>

   <wsdl:message name="AddResponse">

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

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

       <wsdl:part name="in2" type="tns1:Arg1"/>

       <wsdl:part name="in3" type="tns1:Arg2"/>

   </wsdl:message>
---------------------------

Then I write an ant task to convert that wsdl file back to java. In this 
way,  all the holder classes and stubs and the deployment 'wsdd' file would 
be generated for me.

The ant task is like this:
----------------------------
    <target name="wsdl2java">
      <wsdl2java url="IAxisTestService.wsdl"
               output="${home}/GeneratedCode"
               deployscope="session"
               serverside="true"
               noimports="no"
               verbose="no"
               typeMappingVersion="1.1"
               skeletondeploy="false"
               testcase="no">
        <mapping namespace="${deployedwebservicelocation}" 
package="AxisTest2Generated"/>
        <mapping namespace="http://AxisTest2" package="AxisTest2Generated"/>
      </wsdl2java>
    </target>

-----------------------------

After I compiled all the generated file, I deploy it(using an ant task 
again). As follows:

----------------------------
    <target name="deploy">
      <copy todir="${webserver.axis.dir}">
        <fileset dir="${build.dir}">
          <include name="AxisTest2Generated/**/*.class"/>
          <include name="AxisTest2/**/*.class"/>
        </fileset>
      </copy>
      <adminclient
        port="${webserver.port}"
        hostname="${webserver.hostname}"
        failonerror="true"
        servletpath="${webserver.axisadminservlet}"
        debug="true"
        xmlfile="${deploydescriptorfile}">
      </adminclient>
    </target>
----------------------------

Everything is successful so far. However, when I use my web browser to view 
my wsdl file. Axis return an exception as follows:

---------------------------
AXIS error

Sorry, something seems to have gone wrong... here are the details:

Fault - ; nested exception is:
	java.lang.IllegalArgumentException: Illegal argument passed to 
ParameterDesc.setJavaType.  The java type int does not match the mode inout

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.IllegalArgumentException: Illegal argument passed to 
ParameterDesc.setJavaType.  The java type int does not match the mode inout
faultActor:
faultNode:
faultDetail:
---------------------------

The above error is shown on my web browser.

Can somebody tell me what I did wrong? Is this the correct steps to create 
web service using Axis?

Thanks a lot for your help!

Andrew

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*   
http://join.msn.com/?page=features/junkmail


Mime
View raw message