Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-2951

Generating code from WSDL contract using WSDL2Java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Java-SCA-2.0-M1
    • None
    • None
    • Java , windows XP

    Description

      This is a wrong WSDL generated by Tuscany. When I tried to generate java code for a client using WSDL2Java I obtained an error. Person class couldnĀ“t be found. I checked this WSDL file with Eclipse tools and I fixed it. This new file is below.

      ------------------------------
      WRONG WSDL
      ------------------------------

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions name="CalculatorServiceService" targetNamespace="http://server.tuscany.telvent.com/" xmlns:tns="http://server.tuscany.telvent.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/">
      <wsdl:types>
      <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:complexType name="persona"><xs:sequence><xs:element minOccurs="0" name="altura" type="xs:int"/><xs:element name="edad" type="xs:int"/><xs:element minOccurs="0" name="name" type="xs:string"/></xs:sequence></xs:complexType>
      </xs:schema>
      <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://server.tuscany.telvent.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import/><xs:element name="multiply"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divide"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="add"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divideResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtractResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtract"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="addResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersona"><xs:complexType/></xs:element><xs:element name="multiplyResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersonaResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" nillable="true" type="persona"/></xs:sequence></xs:complexType></xs:element></xs:schema>
      </wsdl:types>
      <wsdl:message name="multiply">
      <wsdl:part name="multiply" element="tns:multiply">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="divide">
      <wsdl:part name="divide" element="tns:divide">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="add">
      <wsdl:part name="add" element="tns:add">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="divideResponse">
      <wsdl:part name="divideResponse" element="tns:divideResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="subtractResponse">
      <wsdl:part name="subtractResponse" element="tns:subtractResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="subtract">
      <wsdl:part name="subtract" element="tns:subtract">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="addResponse">
      <wsdl:part name="addResponse" element="tns:addResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getPersona">
      <wsdl:part name="getPersona" element="tns:getPersona">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="multiplyResponse">
      <wsdl:part name="multiplyResponse" element="tns:multiplyResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getPersonaResponse">
      <wsdl:part name="getPersonaResponse" element="tns:getPersonaResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:portType name="CalculatorService">
      <wsdl:operation name="getPersona">
      <wsdl:input message="tns:getPersona">
      </wsdl:input>
      <wsdl:output message="tns:getPersonaResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="add">
      <wsdl:input message="tns:add">
      </wsdl:input>
      <wsdl:output message="tns:addResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="subtract">
      <wsdl:input message="tns:subtract">
      </wsdl:input>
      <wsdl:output message="tns:subtractResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="divide">
      <wsdl:input message="tns:divide">
      </wsdl:input>
      <wsdl:output message="tns:divideResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="multiply">
      <wsdl:input message="tns:multiply">
      </wsdl:input>
      <wsdl:output message="tns:multiplyResponse">
      </wsdl:output>
      </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="CalculatorServiceBinding" type="tns:CalculatorService">
      <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getPersona">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="add">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="subtract">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="divide">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="multiply">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="CalculatorServiceService">
      <wsdl:port name="CalculatorServicePort" binding="tns:CalculatorServiceBinding">
      <SOAP:address location="http://192.168.3.15:8085/CalculatorServiceComponent"/>
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      -------------------------------
      RIGHT WSDL
      -------------------------------
      As you can see there is not a empty "import" in this WSDL, and the "complexType" person is in the same schema like the others components. There is only one schema and I added "tns:" when I need to use person class.

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions name="CalculatorServiceService" targetNamespace="http://server.tuscany.telvent.com/" xmlns:tns="http://server.tuscany.telvent.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/">
      <wsdl:types>

      <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://server.tuscany.telvent.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="multiply"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divide"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="add"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divideResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtractResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtract"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="addResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersona"><xs:complexType/></xs:element><xs:element name="multiplyResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersonaResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" nillable="true" type="tns:persona"/></xs:sequence></xs:complexType></xs:element>
      <xs:complexType name="persona"><xs:sequence><xs:element minOccurs="0" name="altura" type="xs:int"/><xs:element name="edad" type="xs:int"/><xs:element minOccurs="0" name="name" type="xs:string"/></xs:sequence></xs:complexType>
      </xs:schema>
      </wsdl:types>
      <wsdl:message name="multiply">
      <wsdl:part name="multiply" element="tns:multiply">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="divide">
      <wsdl:part name="divide" element="tns:divide">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="add">
      <wsdl:part name="add" element="tns:add">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="divideResponse">
      <wsdl:part name="divideResponse" element="tns:divideResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="subtractResponse">
      <wsdl:part name="subtractResponse" element="tns:subtractResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="subtract">
      <wsdl:part name="subtract" element="tns:subtract">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="addResponse">
      <wsdl:part name="addResponse" element="tns:addResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getPersona">
      <wsdl:part name="getPersona" element="tns:getPersona">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="multiplyResponse">
      <wsdl:part name="multiplyResponse" element="tns:multiplyResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getPersonaResponse">
      <wsdl:part name="getPersonaResponse" element="tns:getPersonaResponse">
      </wsdl:part>
      </wsdl:message>
      <wsdl:portType name="CalculatorService">
      <wsdl:operation name="getPersona">
      <wsdl:input message="tns:getPersona">
      </wsdl:input>
      <wsdl:output message="tns:getPersonaResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="add">
      <wsdl:input message="tns:add">
      </wsdl:input>
      <wsdl:output message="tns:addResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="subtract">
      <wsdl:input message="tns:subtract">
      </wsdl:input>
      <wsdl:output message="tns:subtractResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="divide">
      <wsdl:input message="tns:divide">
      </wsdl:input>
      <wsdl:output message="tns:divideResponse">
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="multiply">
      <wsdl:input message="tns:multiply">
      </wsdl:input>
      <wsdl:output message="tns:multiplyResponse">
      </wsdl:output>
      </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="CalculatorServiceBinding" type="tns:CalculatorService">
      <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getPersona">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="add">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="subtract">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="divide">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="multiply">
      <SOAP:operation/>
      <wsdl:input>
      <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <SOAP:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="CalculatorServiceService">
      <wsdl:port name="CalculatorServicePort" binding="tns:CalculatorServiceBinding">
      <SOAP:address location="http://192.168.3.15:8085/CalculatorServiceComponent"/>
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      Attachments

        Activity

          People

            Unassigned Unassigned
            mipctapetao Santiago Aranda Rojas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: