Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5719

Unable to generate webservice client when ‘wsdl:part’ defined with attribute ‘type’ instead of ‘element’ using wsdl2code plugin

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 1.6.3
    • Fix Version/s: None
    • Component/s: codegen
    • Labels:
    • Environment:
      Development
    • Flags:
      Important

      Description

      Using maven plugin for below mentioned ‘test.wsdl’ schema, webservice axis2 client is generated successfully as expected.

      However, when wsdl:part has been changed from ‘<wsdl:part element="mws:Header" name="HeaderMsg" />’ to ‘<wsdl:part type="mws:HeaderType" name="HeaderMsg" />’, webservice axis2 client code generation is failing with below compilation error, even though changes made to wsdl are schema compliant. Is this a issue with axis2 library to handle this scenario? Please suggest.

      Maven Plugin used for client code generation :

      <plugin>
      <groupId>org.apache.axis2</groupId>
      <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
      <version>1.6.3</version>
      <executions>
      <execution>
      <goals>
      <goal>wsdl2code</goal>
      </goals>
      <configuration>
      <packageName>sample.ws.stub</packageName>
      <wsdlFile>file:///c:/test.wsdl</wsdlFile>
      <databindingName>xmlbeans</databindingName>
      </configuration>
      </execution>
      </executions>
      </plugin>

      Working Schema (test.wsdl) :

      <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:mws="http://schemas.company.net/header"
      xmlns:tns="http://schemas.company.com/test"
      name="test" targetNamespace="http://schemas.company.com/test">
      <wsdl:types>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.company.com/test" elementFormDefault="qualified">
      <xsd:element name="Request" type="tns:RequestType" />
      <xsd:complexType name="RequestType">
      <xsd:sequence>
      <xsd:element name="el1" type="xsd:string" />
      </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="Response" type="tns:ResponseType" />
      <xsd:complexType name="ResponseType">
      <xsd:sequence>
      <xsd:element name="el2" type="xsd:string" />
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.company.net/header" targetNamespace="http://schemas.company.net/header" elementFormDefault="qualified">
      <xsd:element name="Header" type="tns:HeaderType" />
      <xsd:complexType name="HeaderType">
      <xsd:sequence>
      <xsd:element name="user" type="xsd:string" />
      <xsd:element name="password" type="xsd:string" />
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>
      </wsdl:types>
      <wsdl:message name="RequestMsg">
      <wsdl:part element="tns:Request" name="RequestMsg" />
      </wsdl:message>
      <wsdl:message name="ResponseMsg">
      <wsdl:part element="tns:Response" name="ResponseMsg" />
      </wsdl:message>
      <wsdl:message name="HeaderMsg">
      <wsdl:part element="mws:Header" name="HeaderMsg" />
      </wsdl:message>
      <wsdl:portType name="Test">
      <wsdl:operation name="Test">
      <wsdl:input message="tns:RequestMsg" />
      <wsdl:output message="tns:ResponseMsg" />
      </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="TestSoapBinding" type="tns:Test">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="Test">
      <soap:operation soapAction="Test" />
      <wsdl:input>
      <soap:body use="literal" parts="RequestMsg" />
      <soap:header use="literal" part="HeaderMsg" message="tns:HeaderMsg" />
      </wsdl:input>
      <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="TestService">
      <wsdl:port name="Test" binding="tns:TestSoapBinding">
      <soap:address location="http://server:9081/services/KKTEST2" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      Non-Working Schema :

      when changed above schema for wsdl:part to use attribute ‘type’ instead of ‘element’, following compilation error is coming.
      <wsdl:part type="mws:HeaderType" name="HeaderMsg" />

      Compilation Error:

      [INFO] -------------------------------------------------------------
      [ERROR] C:\WorkSpace\test-wsdl2code\target\generated-sources\axis2\wsdl2code\src\sample\ws\stub\TestServiceStub.java:[150,16] cannot find symbol
      symbol : variable param2
      location: class sample.ws.stub.TestServiceStub
      [ERROR] C:\WorkSpace\test-wsdl2code\target\generated-sources\axis2\wsdl2code\src\sample\ws\stub\TestServiceStub.java:[151,69] cannot find symbol
      symbol : variable param2
      location: class sample.ws.stub.TestServiceStub
      [ERROR] C:\WorkSpace\test-wsdl2code\target\generated-sources\axis2\wsdl2code\src\sample\ws\stub\TestServiceStub.java:[269,12] cannot find symbol
      symbol : variable param2
      location: class sample.ws.stub.TestServiceStub
      [ERROR] C:\WorkSpace\test-wsdl2code\target\generated-sources\axis2\wsdl2code\src\sample\ws\stub\TestServiceStub.java:[270,65] cannot find symbol
      symbol : variable param2
      location: class sample.ws.stub.TestServiceStub

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vchoudhari Vishal Choudhari
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: