无法使用Eclipse在CXF中使用wsdl2java创建Web服务

时间:2017-09-20 10:15:02

标签: java eclipse web-services soap wsdl

我正在尝试从WSDL文件创建Web服务。

我正在使用Eclipse 4.6.2(Neon 2),Apache CXF 3.2.0和Tomcat 9。

创建动态Web项目后,我将我的WSDL文件复制到WebContent文件夹,并使用它来生成自上而下的Java bean Web服务。我想创建一个测试Web客户端,因此我将滑块设置为“启动服务”和“启动客户端”,并选中发布和监视WS的选项。然后我单击完成。过了一会儿,该过程将以错误终止。这是我在控制台上得到的:

Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -d C:\Users\USER\workspace\TestWS\.cxftmp/src -classdir C:\Users\USER\workspace\TestWS\build\classes -p http://www.dematic.com/ndcwebservices/=com.dematic.ndcwebservices -impl -validate -exsh false -dns true -dex true -wsdlLocation file:/C:/Users/USER/workspace/TestWS/WebContent/ndcwebservices_single.wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 file:/C:/Users/USER/workspace/TestWS/WebContent/ndcwebservices_single.wsdl
wsdl2java - Apache CXF 3.2.0

Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}Start cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}StopAci cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}CheckIsConnected cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}StartOrder cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}CancelOrder cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}CancelOrderByCarrier cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}SendAck cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}SendNack cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}UpdatePriority cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}UpdateParameter cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}ReadParameters cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}ReadGlobalParameters cannot be unwrapped, input message must reference global element declaration with same localname as operation
Sep 20, 2017 5:53:08 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation {http://www.dematic.com/ndcwebservices/}WriteGlobalParameter cannot be unwrapped, input message must reference global element declaration with same localname as operation

这是我正在使用的WSDL文件的一部分。完全是616行,我试图省略我认为与问题无关的内容。

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="AciService" targetNamespace="http://www.dematic.com/ndcwebservices/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://www.dematic.com/ndcwebservices/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsp:Policy wsu:Id="CustomBinding_IAciService_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <wsaw:UsingAddressing/>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>
        <xs:schema elementFormDefault="qualified" targetNamespace="http://www.dematic.com/ndcwebservices/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:import namespace="http://schemas.datacontract.org/2004/07/NDC.WebServices.DataContracts"/>
            <xs:import namespace="http://schemas.datacontract.org/2004/07/NDC.ACI"/>
            <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            ...
            <xs:element name="NDCServiceResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="response" nillable="true" type="tns:NDCServiceResp"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:complexType name="NDCServiceResp">
                <xs:sequence>
                    <xs:element minOccurs="0" name="IsError" type="xs:boolean"/>
                    <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="NDCServiceResp" nillable="true" type="tns:NDCServiceResp"/>
            ...
        </xs:schema>
        ...
    </wsdl:types>
    ...
    <wsdl:portType name="IAciService">
        <wsdl:operation name="Start">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/Start" name="StartRequest" message="tns:StartRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/StartResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="StopAci">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/StopAci" name="StopAciRequest" message="tns:StopAciRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/StopAciResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="CheckIsConnected">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/CheckIsConnected" name="CheckIsConnectedRequest" message="tns:CheckIsConnectedRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/CheckIsConnectedResponse" name="NDCServiceIsConnectedResponse" message="tns:NDCServiceIsConnectedResponse"/>
        </wsdl:operation>
        <wsdl:operation name="StartOrder">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/StartOrder" name="StartOrderRequest" message="tns:StartOrderRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/StartOrderResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="CancelOrder">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/CancelOrder" name="CancelOrderRequest" message="tns:CancelOrderRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/CancelOrderResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="CancelOrderByCarrier">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/CancelOrderByCarrier" name="CancelOrderByCarrierRequest" message="tns:CancelOrderByCarrierRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/CancelOrderByCarrierResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="SendAck">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/SendAck" name="SendAckRequest" message="tns:SendAckRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/SendAckResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="SendNack">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/SendNack" name="SendNackRequest" message="tns:SendNackRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/SendNackResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="UpdatePriority">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/UpdatePriority" name="UpdatePriorityRequest" message="tns:UpdatePriorityRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/UpdatePriorityResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="UpdateParameter">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/UpdateParameter" name="UpdateParameterRequest" message="tns:UpdateParameterRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/UpdateParameterResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="ReadParameters">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/ReadParameters" name="ReadParametersRequest" message="tns:ReadParametersRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/ReadParametersResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="ReadGlobalParameters">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/ReadGlobalParameters" name="ReadGlobalParametersRequest" message="tns:ReadGlobalParametersRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/ReadGlobalParametersResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
        <wsdl:operation name="WriteGlobalParameter">
            <wsdl:input wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/WriteGlobalParameter" name="WriteGlobalParameterRequest" message="tns:WriteGlobalParameterRequest"/>
            <wsdl:output wsaw:Action="http://www.dematic.com/ndcwebservices/IAciService/WriteGlobalParameterResponse" name="NDCServiceResponse" message="tns:NDCServiceResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="CustomBinding_IAciService" type="tns:IAciService">
        <wsp:PolicyReference URI="#CustomBinding_IAciService_policy"/>
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="Start">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/Start" style="document"/>
            <wsdl:input name="StartRequest">
                <soap12:header message="tns:StartRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:StartRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="StopAci">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/StopAci" style="document"/>
            <wsdl:input name="StopAciRequest">
                <soap12:header message="tns:StopAciRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:StopAciRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="CheckIsConnected">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/CheckIsConnected" style="document"/>
            <wsdl:input name="CheckIsConnectedRequest">
                <soap12:header message="tns:CheckIsConnectedRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:CheckIsConnectedRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceIsConnectedResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="StartOrder">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/StartOrder" style="document"/>
            <wsdl:input name="StartOrderRequest">
                <soap12:header message="tns:StartOrderRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:StartOrderRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="CancelOrder">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/CancelOrder" style="document"/>
            <wsdl:input name="CancelOrderRequest">
                <soap12:header message="tns:CancelOrderRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:CancelOrderRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="CancelOrderByCarrier">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/CancelOrderByCarrier" style="document"/>
            <wsdl:input name="CancelOrderByCarrierRequest">
                <soap12:header message="tns:CancelOrderByCarrierRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:CancelOrderByCarrierRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="SendAck">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/SendAck" style="document"/>
            <wsdl:input name="SendAckRequest">
                <soap12:header message="tns:SendAckRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:SendAckRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="SendNack">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/SendNack" style="document"/>
            <wsdl:input name="SendNackRequest">
                <soap12:header message="tns:SendNackRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:SendNackRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="UpdatePriority">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/UpdatePriority" style="document"/>
            <wsdl:input name="UpdatePriorityRequest">
                <soap12:header message="tns:UpdatePriorityRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:UpdatePriorityRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="UpdateParameter">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/UpdateParameter" style="document"/>
            <wsdl:input name="UpdateParameterRequest">
                <soap12:header message="tns:UpdateParameterRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:UpdateParameterRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="ReadParameters">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/ReadParameters" style="document"/>
            <wsdl:input name="ReadParametersRequest">
                <soap12:header message="tns:ReadParametersRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:ReadParametersRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="ReadGlobalParameters">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/ReadGlobalParameters" style="document"/>
            <wsdl:input name="ReadGlobalParametersRequest">
                <soap12:header message="tns:ReadGlobalParametersRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:ReadGlobalParametersRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="WriteGlobalParameter">
            <soap12:operation soapAction="http://www.dematic.com/ndcwebservices/IAciService/WriteGlobalParameter" style="document"/>
            <wsdl:input name="WriteGlobalParameterRequest">
                <soap12:header message="tns:WriteGlobalParameterRequest_Headers" part="AuthenticationHeader" use="literal"/>
                <soap12:header message="tns:WriteGlobalParameterRequest_Headers" part="RequestHeader" use="literal"/>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="NDCServiceResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="AciService">
        <wsdl:port name="CustomBinding_IAciService" binding="tns:CustomBinding_IAciService">
            <soap12:address location="http://localhost:8779/ndcwebservices"/>
            <wsa10:EndpointReference>
                <wsa10:Address>http://localhost:8779/ndcwebservices</wsa10:Address>
            </wsa10:EndpointReference>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

当我在Eclipse中验证此WSDL时,我收到11个错误,所有错误都包含以下消息:

The name 'NDCServiceResponse' specified for this output element is not unique. The name of an output element must be unique from the names of all other inputs and output elements defined in the 'IAciService' port type.

这两个有关吗?我应该在WSDL中更改什么以确保我能够运行一个非常基本的Web服务?

(编辑:如果有人愿意通过复制此问题来帮助我,我可以提供完整的WSDL文件)

0 个答案:

没有答案