WSDL2Java generates client and server code that both yield compile errors
-------------------------------------------------------------------------

                 Key: AXIS2-1750
                 URL: http://issues.apache.org/jira/browse/AXIS2-1750
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
    Affects Versions: 1.1
            Reporter: Michael Moser


When running WSDL2Java to generate the server side code I am getting two 
classes on which the compiler yells:

ClassifiedServiceMessageReceiverInOnly.java line 296
The method getNamespaceURI() is undefined for the type OMNamespace

ClassifiedServiceMessageReceiverInOut.java line 343
The method getNamespaceURI() is undefined for the type OMNamespace

Both methods read:
-----------------------
...
/**
* A utility method that copies the namepaces from the SOAPEnvelope
*/
private java.util.Map 
getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
java.util.Map returnMap = new java.util.HashMap();
java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
while (namespaceIterator.hasNext()) {
org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) 
namespaceIterator.next();
returnMap.put(ns.getPrefix(),ns.getNamespaceURI()); // <<<< unknown 
method
}
return returnMap;
}
...
-----------------------

Similar, when generating the client code: In the generated code for class 
ClassifiedServiceStub there are multiple locations that read:
-----------------------
...
//adding SOAP headers
_serviceClient.addHeadersToEnvelope(env); // <<< does not exist
...
-----------------------
I assume that should read "addHeader(env)" instead.

The WSDL used - essentially taken from the tutorial "Understanding Web Services 
specifications, Part 2: Web Services Description Language (WSDL)" located at 
http://www-128.ibm.com/developerworks/edu/ws-dw-ws-understand-web-services2.html:
-----------------------
<wsdl:definitions xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
       xmlns:tns="http://ws.apache.org/axis2";

       xmlns:axis2="http://ws.apache.org/axis2";
       xmlns:ns1="http://org.apache.axis2/xsd"; 
 
       targetNamespace="http://ws.apache.org/axis2";>

<wsdl:types>
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
         targetNamespace="http://org.apache.axis2/xsd"; 
         elementFormDefault="unqualified" 
         attributeFormDefault="unqualified">

    <xs:element type="ns1:ClassifiedAd" name="ClassifiedAd" />
    <xs:complexType name="ClassifiedAd">
      <xs:sequence>
        <xs:element type="xs:int" name="id" />
        <xs:element type="xs:string" name="content" />
        <xs:element type="xs:string" name="endDate" />
        <xs:element type="xs:string" name="startDate" />
      </xs:sequence>
    </xs:complexType>

    <xs:element type="ns1:ClassifiedList" name="ClassifiedList" />
    <xs:complexType name="ClassifiedList">
      <xs:sequence>
        <xs:element minOccurs="0" type="ns1:ClassifiedAd" name="ClassifiedAd" 
maxOccurs="unbounded" />
      </xs:sequence>
    </xs:complexType>

    <xs:element name="createNewAdRequest">
      <xs:complexType>
        <xs:sequence>
          <xs:element type="xs:string" name="content" />
          <xs:element type="xs:string" name="endDate" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

    <xs:element name="createNewAdResponse">
      <xs:complexType>
        <xs:sequence>
          <xs:element type="xs:int" name="newAdId" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

    <xs:element name="editExistingAdRequest">
      <xs:complexType>
        <xs:sequence>
          <xs:element type="ns1:ClassifiedAd" name="existingAd" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

    <xs:element name="editExistingAdResponse">
      <xs:complexType>
        <xs:sequence>
          <xs:element type="xs:boolean" name="wasSuccessful" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

    <xs:element name="getExistingAdsRequest">
      <xs:complexType />
    </xs:element>

    <xs:element name="getExistingAdsResponse">
      <xs:complexType>
        <xs:sequence>
          <xs:element type="ns1:ClassifiedList" name="ClassifiedList" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

    <xs:element name="finalizeIssueRequest">
      <xs:complexType>
        <xs:sequence>
          <xs:element type="xs:string" name="issueToFinalize" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

  </xs:schema>

</wsdl:types>

<wsdl:message name="createNewAdRequestMessage">
  <wsdl:part name="part1" element="ns1:createNewAdRequest" />
</wsdl:message>

<wsdl:message name="createNewAdResponseMessage">
  <wsdl:part name="part1" element="ns1:createNewAdResponse" />
</wsdl:message>

<wsdl:message name="getExistingAdsResponseMessage">
  <wsdl:part name="part1" element="ns1:getExistingAdsResponse" />
</wsdl:message>

<wsdl:message name="editExistingAdRequestMessage">
  <wsdl:part name="part1" element="ns1:editExistingAdRequest" />
</wsdl:message>

<wsdl:message name="getExistingAdsRequestMessage">
  <wsdl:part name="part1" element="ns1:getExistingAdsRequest" />
</wsdl:message>

<wsdl:message name="mainRequestMessage">
  <wsdl:part name="part1" element="ns1:mainRequest" />
</wsdl:message>

<wsdl:message name="editExistingAdResponseMessage">
  <wsdl:part name="part1" element="ns1:editExistingAdResponse" />
</wsdl:message>

<wsdl:message name="finalizeIssueRequestMessage">
  <wsdl:part name="part1" element="ns1:finalizeIssueRequest" />
</wsdl:message>

<wsdl:portType name="ClassifiedServicePortType">

  <wsdl:operation name="finalizeIssue">
    <wsdl:input message="tns:finalizeIssueRequestMessage" />
  </wsdl:operation>

  <wsdl:operation name="createNewAd">
    <wsdl:input message="tns:createNewAdRequestMessage" />
    <wsdl:output message="tns:createNewAdResponseMessage" />
  </wsdl:operation>

  <wsdl:operation name="editExistingAd">
    <wsdl:input message="tns:editExistingAdRequestMessage" />
    <wsdl:output message="tns:editExistingAdResponseMessage" />
  </wsdl:operation>

  <wsdl:operation name="getExistingAds">
    <wsdl:input message="tns:getExistingAdsRequestMessage" />
    <wsdl:output message="tns:getExistingAdsResponseMessage" />
  </wsdl:operation>

</wsdl:portType>

<wsdl:binding name="ClassifiedServiceBinding" 
type="tns:ClassifiedServicePortType">

  <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="document" />

  <wsdl:operation name="createNewAd">
    <soap:operation soapAction="createNewAd" style="document" />
    <wsdl:input>
      <soap:body use="literal" namespace="http://ws.apache.org/axis2"; />
    </wsdl:input>
    <wsdl:output>
      <soap:body use="literal" namespace="http://ws.apache.org/axis2"; />
    </wsdl:output>
  </wsdl:operation>

  <wsdl:operation name="finalizeIssue">
    <soap:operation soapAction="finalizeIssue" style="document" />
    <wsdl:input>
      <soap:body use="literal" namespace="http://ws.apache.org/axis2"; />
    </wsdl:input>
  </wsdl:operation>

  <wsdl:operation name="editExistingAd">
    <soap:operation soapAction="editExistingAd" style="document" />
    <wsdl:input>
      <soap:body use="literal" namespace="http://ws.apache.org/axis2"; />
    </wsdl:input>
    <wsdl:output>
      <soap:body use="literal" namespace="http://ws.apache.org/axis2"; />
    </wsdl:output>
  </wsdl:operation>

  <wsdl:operation name="getExistingAds">
    <soap:operation soapAction="getExistingAds" style="document" />
    <wsdl:input>
      <soap:body use="literal" namespace="http://ws.apache.org/axis2"; />
    </wsdl:input>
    <wsdl:output>
      <soap:body use="literal" namespace="http://ws.apache.org/axis2"; />
    </wsdl:output>
  </wsdl:operation>

</wsdl:binding>

<wsdl:service name="ClassifiedService">
  <wsdl:port name="ClassifiedServicePort" 
binding="axis2:ClassifiedServiceBinding">
    <soap:address 
location="http://localhost:8080/axis2/services/ClassifiedService"; />
  </wsdl:port>
</wsdl:service>

</wsdl:definitions>
-----------------------

Windows batch file "generateServiceFromWSDL.bat" used to generate the service:
-----------------------
set CURRENT_DIR=%cd%
setlocal EnableDelayedExpansion

if ("%JAVA_HOME%"=="") set JAVA_HOME=C:\JDK1.5.0
if ("%AXIS2_HOME%"=="") set AXIS2_HOME=C:\Java_Extensions\axis2-1.1
rem call %AXIS2_HOME%\bin\java2wsdl.bat -cn 
org.dailymoon.classifieds.ClassifiedService -o .

set AXIS2_CLASS_PATH=.
FOR %%c in ("%AXIS2_HOME%\lib\*.jar") DO set 
AXIS2_CLASS_PATH=!AXIS2_CLASS_PATH!;%%c

cd C:\JavaDevt\tutorials\webservices\ClassifiedAds
"%JAVA_HOME%\bin\java" -cp "%AXIS2_CLASS_PATH%" org.apache.axis2.wsdl.WSDL2Java 
-uri ClassifiedService.wsdl -ss -sd -p org.dailymoon.classifieds -d xmlbeans -o 
service

endlocal
pause
-----------------------

Windows batch file "generateClientFromWSDL.bat" used to generate the client:
-----------------------
set CURRENT_DIR=%cd%
setlocal EnableDelayedExpansion

if ("%JAVA_HOME%"=="") set JAVA_HOME=C:\JDK1.5.0
if ("%AXIS2_HOME%"=="") set AXIS2_HOME=C:\Java_Extensions\axis2-1.1
rem call %AXIS2_HOME%\bin\java2wsdl.bat -cn 
org.dailymoon.classifieds.ClassifiedService -o .

set AXIS2_CLASS_PATH=.
FOR %%c in ("%AXIS2_HOME%\lib\*.jar") DO set 
AXIS2_CLASS_PATH=!AXIS2_CLASS_PATH!;%%c

cd C:\JavaDevt\tutorials\webservices\ClassifiedAds
"%JAVA_HOME%\bin\java" -cp "%AXIS2_CLASS_PATH%" org.apache.axis2.wsdl.WSDL2Java 
-uri ClassifiedService.wsdl -p org.dailymoon.classifieds -d xmlbeans -o client

endlocal
pause
-----------------------

Regards,
Michael

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to