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 Steffen Bleul <bl...@vs.uni-kassel.de> on 2007/08/14 13:17:27 UTC

Problem with AXIS WSDL2Java

Hi,

I have a code generation problem with Axis 1.4 and WSDL2Java. WSDL2Java 
is running fine as long as i just use simple types in the Web Service 
interfaces. But after defining my own ComplexType it does not work 
anymore. I have the suspicion that there is some fault in WSDL2Java.

--------------------------------
Step 1
--------------------------------

I am deploying a java implemented Web Services in Axis:

public interface 
de.vs.unikassel.WebServiceInterface.Server.ProxyControlWebService {
      public ProxyData listProxies();
      public void addProxy(ProxyData data);
}

--------------------------------
Step 2
--------------------------------

ProxyData is a simple Bean:

public class de.vs.unikassel.WebServiceInterface.Server.ProxyData 
implements java.io.Serializable {
   private java.lang.String name;

   private java.lang.String servletcontext;

   private java.lang.String servletname;

   private java.lang.String servletpath;

   private java.lang.String servlettype;

   private java.lang.String targetAdress;

...
}

--------------------------------
Step 3
--------------------------------

ProxyData can be successfully transformed to WSDL using  Java2WSDL:

<wsdl:types>
 <schema elementFormDefault="qualified" 
targetNamespace="http://www.vs.uni-kassel.de/ADDO/" 
xmlns="http://www.w3.org/2001/XMLSchema">
  <complexType name="ProxyData">
   <sequence>
    <element name="name" nillable="true" type="xsd:string"/>
    <element name="servletcontext" nillable="true" type="xsd:string"/>
    <element name="servletname" nillable="true" type="xsd:string"/>
    <element name="servletpath" nillable="true" type="xsd:string"/>
    <element name="servlettype" nillable="true" type="xsd:string"/>
    <element name="targetAdress" nillable="true" type="xsd:string"/>
   </sequence>
  </complexType>
  <element name="listProxiesReturn" type="impl:ProxyData"/>
  <element name="in0" type="impl:ProxyData"/>
 </schema>
</wsdl:types>

<wsdl:message name="listProxiesResponse">
     <wsdl:part element="impl:listProxiesReturn" name="listProxiesReturn"/>
</wsdl:message>

<wsdl:message name="listProxiesRequest"></wsdl:message>

<wsdl:operation name="listProxies">
   <wsdl:input message="impl:listProxiesRequest" 
name="listProxiesRequest"/>
   <wsdl:output message="impl:listProxiesResponse" 
name="listProxiesResponse"/>
</wsdl:operation>

<wsdl:message name="addProxyResponse"></wsdl:message>

<wsdl:message name="addProxyRequest">
   <wsdl:part element="impl:in0" name="in0"/>
</wsdl:message>

<wsdl:operation name="addProxy" parameterOrder="in0">
   <wsdl:input message="impl:addProxyRequest" name="addProxyRequest"/>
   <wsdl:output message="impl:addProxyResponse" name="addProxyResponse"/>
</wsdl:operation>
     --------------------------------
Step 4
--------------------------------

Also the generation of the client side java Proxy Data is successfull:

public class de.vs.unikassel.WebServiceInterface.Client.ProxyData  
implements java.io.Serializable {
   private java.lang.String name;

   private java.lang.String servletcontext;

   private java.lang.String servletname;

   private java.lang.String servletpath;

   private java.lang.String servlettype;

   private java.lang.String targetAdress;
      ...
}

--------------------------------
Step 5
--------------------------------

The client application now tests the operation listProxies():

de.vs.unikassel.WebServiceInterface.Client.ProxyData data = null;

ProxyControlWebService control = proxylocator.getProxyControlWebService();
data = control.listProxies();

--------------------------------
Step 6
--------------------------------

I get the client side error that the parser cannot find the element 
"listProxiesReturn":

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Invalid element in 
de.vs.unikassel.WebServiceInterface.Client.ProxyData - listProxiesReturn
faultActor:
faultNode:
faultDetail:
   {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: 
Invalid element in de.vs.unikassel.WebServiceInterface.Client.ProxyData 
- listProxiesReturn
   But using a SOAP monitor it is clear, that it is an existing element:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
       <listProxiesResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
           <listProxiesReturn href="#id0"/>
       </listProxiesResponse>
       <multiRef id="id0" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xsi:type="ns1:ProxyData" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://www.vs.uni-kassel.de/ADDO/">
           <name xsi:type="xsd:string">Test</name>
           <servletcontext xsi:type="xsd:string">Test</servletcontext>
           <servletname xsi:type="xsd:string">Test</servletname>
           <servletpath xsi:type="xsd:string">Test</servletpath>
           <servlettype xsi:type="xsd:string">Test</servlettype>
           <targetAdress xsi:type="xsd:string">Test</targetAdress>
       </multiRef>
   </soapenv:Body>
</soapenv:Envelope>

--------------------------------
Step 7
--------------------------------

The client application now tests the operation addProxy(ProxyData data):

de.vs.unikassel.WebServiceInterface.Client.ProxyData data = new 
de.vs.unikassel.WebServiceInterface.Client.ProxyData();

actservlet.setServletcontext("Test");
actservlet.setServletname("Test");
actservlet.setName("Test");
actservlet.setServletpath("Test");
actservlet.setServlettype("Test");
actservlet.setTargetAdress("Test");

ProxyControlWebService control = proxylocator.getProxyControlWebService();
control.addProxy(actservlet);

--------------------------------
Step 8
--------------------------------

I get the server side error that the parser cannot find the operation 
"in0":

AxisFault
faultCode: {http://xml.apache.org/axis/}Client
faultSubcode:
faultString: No such operation 'in0'
faultActor:
faultNode:
faultDetail:

This is clear, the client sends die SOAP-Request:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
       <in0 xmlns="http://www.vs.uni-kassel.de/ADDO/">
           <name>Test</name>
           <servletcontext>Test</servletcontext>
           <servletname>Test</servletname>
           <servletpath>Test</servletpath>
           <servlettype>Test</servlettype>
           <targetAdress>Test</targetAdress>
       </in0>
   </soapenv:Body>
</soapenv:Envelope>

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

Can somebody verify this problem and how to solve it?

Best regards,
Steffen Bleul

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org