0

为什么来自axis2的java2wsdl产生未经Altova XmlSpy验证的wsdl?

我有错误

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

错误在哪里?

axis2 版本 1.5.4

Altova XmlSpy 版本 2011 rel2

样本类:

package my.pkg;

public class SampleWs {

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

}

示例生成的 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>
4

1 回答 1

0

似乎axis2 java2wsdl 1.5.4版中的错误

切换到 1.6.2 版本 - 现在一切正常

于 2012-11-26T13:45:02.310 回答