web-servicesapache-axisxmlspyjava2wsdl

Why java2wsdl from axis2 produce not valid wsdl


Why java2wsdl from axis2 produce wsdl not validated by Altova XmlSpy?

I got error

attribute 'part' in extensibility element '<mime:content>' refers to part 'myMethod' which could not be found in message 'myMethodRequest'
    Error location: wsdl:definitions / wsdl:binding / wsdl:operation / wsdl:input / mime:content / @part

Where is the bug?

axis2 version 1.5.4

Altova XmlSpy version 2011 rel2

Sample Class:

package my.pkg;

public class SampleWs {

    public String myMethod(String objectId) {
        return objectId; 
    }

}

Sample generated wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://pkg.my" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://pkg.my">
    <wsdl:types>
        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pkg.my">
            <xs:element name="myMethod">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="objectId" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="myMethodResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="myMethodRequest">
        <wsdl:part name="parameters" element="ns:myMethod"/>
    </wsdl:message>
    <wsdl:message name="myMethodResponse">
        <wsdl:part name="parameters" element="ns:myMethodResponse"/>
    </wsdl:message>
    <wsdl:portType name="SampleWsPortType">
        <wsdl:operation name="myMethod">
            <wsdl:input message="ns:myMethodRequest" wsaw:Action="urn:myMethod"/>
            <wsdl:output message="ns:myMethodResponse" wsaw:Action="urn:myMethodResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="SampleWsSoap11Binding" type="ns:SampleWsPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="myMethod">
            <soap:operation soapAction="urn:myMethod" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="SampleWsSoap12Binding" type="ns:SampleWsPortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="myMethod">
            <soap12:operation soapAction="urn:myMethod" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="SampleWsHttpBinding" type="ns:SampleWsPortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="myMethod">
            <http:operation location="SampleWs/myMethod"/>
            <wsdl:input>
                <mime:content type="text/xml" part="myMethod"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="myMethod"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="SampleWs">
        <wsdl:port name="SampleWsHttpSoap11Endpoint" binding="ns:SampleWsSoap11Binding">
            <soap:address location="http://localhost:8080/axis2/services/SampleWs"/>
        </wsdl:port>
        <wsdl:port name="SampleWsHttpSoap12Endpoint" binding="ns:SampleWsSoap12Binding">
            <soap12:address location="http://localhost:8080/axis2/services/SampleWs"/>
        </wsdl:port>
        <wsdl:port name="SampleWsHttpEndpoint" binding="ns:SampleWsHttpBinding">
            <http:address location="http://localhost:8080/axis2/services/SampleWs"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

Solution

  • It seems bug in axis2 java2wsdl version 1.5.4

    Switched to 1.6.2 version - now all OK