axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Mittelstädt (JIRA) <j...@apache.org>
Subject [jira] Kommentiert: (AXIS2-544) Java2WSDL generates invalid WSDL
Date Mon, 03 Apr 2006 14:33:53 GMT
    [ http://issues.apache.org/jira/browse/AXIS2-544?page=comments#action_12372952 ] 

Sebastian Mittelstädt commented on AXIS2-544:
---------------------------------------------

I got it running, when you specify no namespaces (no -tn -tp -stn -stp) the generated WSDL
is valid.

HOWEVER:

When specifying namespaces, the generated WSDL contains errors at the wsdl:message definitions:
The wsdl:part element is buggy.

The "element" attribute gets assigned the wrong namespace, it gets actually assigned the TNS
of the WSDL, but it must be assigned the schema-namespace. In addition, the schema-namespace
has to be be declared at the wsdl:definitions element.

Here is the generated invalid WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws.apache.org/axis2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ws.apache.org/axis2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns1="http://org.apache.axis2/xsd">
  <wsdl:types>
    <xs:schema targetNamespace="com.mycompany.r002.schema" elementFormDefault="unqualified"
attributeFormDefault="unqualified" xmlns:r002schema="com.mycompany.r002.schema">
    <!-- Some definitions omitted -->
      <xs:element name="calculate">
        <xs:complexType>
          <xs:sequence>
            <xs:element type="r002schema:Input" name="param0"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="calculateResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element type="r002schema:Output" name="return"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="calculateRequestMessage">
    <wsdl:part element="ns1:calculate" name="part1"/>
  </wsdl:message>
  <wsdl:message name="calculateReponseMessage">
    <wsdl:part element="ns1:calculateResponse" name="part1"/>
  </wsdl:message>
  <wsdl:portType name="r002PortType">
    <wsdl:operation name="calculate">
      <wsdl:input message="tns:calculateRequestMessage"/>
      <wsdl:output message="tns:calculateReponseMessage"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding type="tns:r002PortType" name="r002SOAP11Binding">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="calculate">
      <soap:operation style="document" soapAction="calculate"/>
      <wsdl:input>
        <soap:body namespace="com.mycompany.r002" use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body namespace="com.mycompany.r002" use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="r002">
    <wsdl:port binding="tns:r002SOAP11Binding" name="r002port">
      <soap:address location="http://localhost:8080/axis2/services/r002"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


Have a look at this
<snippet>
   <wsdl:message name="calculateRequestMessage">
      <wsdl:part element="ns1:calculate" name="part1"/>
  </wsdl:message>
</snippet>

Actually, ns1 is xmlns:ns1="http://org.apache.axis2/xsd".

But for the WSDL to be valid, the namespace has to be r002schema,  the schema-namespace.

Correct would be
<snippet>
   <wsdl:message name="calculateRequestMessage">
    <wsdl:part element="r002schema:calculate" name="part1"/>
  </wsdl:message>
</snippet>

The namespace r002schema is xmlns:r002schema="com.mycompany.r002.schema", but it is actually
only defined at the schema.

For the WSDL to be valid, it has to be declared at the wsdl:definitions element.

With those changes, the WSDL is valid.






 



> Java2WSDL generates invalid WSDL
> --------------------------------
>
>          Key: AXIS2-544
>          URL: http://issues.apache.org/jira/browse/AXIS2-544
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: Tools
>     Versions: 0.95
>     Reporter: Sebastian Mittelstädt

>
> In 0.95, the Java2WSDL class generates invalid WSDL. 
> The following WSDL was generated with Java2WSDL:
> java2wsdl -cn com.mycompany.r002.R002 -cp bin -tn http://com.mycompany.r002 -stn http://com.mycompany.r002.schema
-stp r002schema -sn r002 -of r002.wsdl
> This generated the following WSDL:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace="http://com.mycompany.r002" 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://com.mycompany.r002">
>   <wsdl:types>
>     <xs:schema targetNamespace="http://com.mycompany.r002.schema" elementFormDefault="unqualified"
attributeFormDefault="unqualified" xmlns:r002schema="http://com.mycompany.r002.schema">
>       <!-- Type definitions (omitted) -->
>     </xs:schema>
>   </wsdl:types>
>   <wsdl:message name="calculateResponseMessage">
>     <wsdl:part name="part1" element="r002schema:calculateResponse"/>
>   </wsdl:message>
>   <wsdl:message name="calculateRequestMessage">
>     <wsdl:part name="part1" element="r002schema:calculateRequest"/>
>   </wsdl:message>
>   <wsdl:portType name="r002PortType">
>     <wsdl:operation name="calculate">
>       <wsdl:input message="tns:calculateRequestMessage"/>
>       <wsdl:output message="tns:calculateResponseMessage"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="r002Binding" type="tns:r002PortType">
>     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
>     <wsdl:operation name="calculate">
>       <soap:operation soapAction="calculate" style="document"/>
>       <wsdl:input>
>         <soap:body use="literal" namespace="http://com.mycompany.r002"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal" namespace="http://com.mycompany.r002"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="r002">
>     <wsdl:port name="r002Port" binding="axis2:r002Binding">
>       <soap:address location="http://127.0.0.1:8080/axis2/services/r002"/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
> This WSDL is invalid due to the following errors:
> - The value 'axis2:r002Binding' of attribute 'binding' on element 'wsdl:port' is not
valid with respect to its type, 'QName'.
> - The value 'r002schema:calculateRequest' of attribute 'element' on element 'wsdl:part'
is not valid with respect to its type, 'QName'.
> - The value 'r002schema:calculateResponse' of attribute 'element' on element 'wsdl:part'
is not valid with respect to its type, 'QName'.	
> - Cannot resolve 'axis2:r002Binding' as a QName: the prefix 'axis2' is not declared.
> - Cannot resolve 'r002schema:calculateRequest' as a QName: the prefix 'r002schema' is
not declared.
> - Cannot resolve 'r002schema:calculateResponse' as a QName: the prefix 'r002schema' is
not declared.

-- 
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


Mime
View raw message