2012-11-26 25 views
0

爲什麼來自axis2的java2wsdl產生wsdl未通過Altova XmlSpy驗證?爲什麼來自axis2的java2wsdl產生無效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> 

回答

0

看來臭蟲Axis2的java2wsdl版本1.5.4

切換到1.6.2版本 - 現在全部好了