我使用 Java SE 7 Update 5,并且可以使用 wsimport 导入以下 WSDL 文件(仅使用 -extension 选项)。但是在发布端点的情况下,我会得到以下异常。如果我将 BindingType 从:
@BindingType(SOAPBinding.SOAP12HTTP_BINDING)
至:
@BindingType(value = "http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/")
然后我可以启动服务,但我收到此警告:“为指定的绑定生成非标准 WSDL”警告本身不是问题,但是当我从外部客户端访问/导入已发布的 WSDL 时(例如soapUI),那么请求格式错误并且它们不起作用。(缺少元素)
WSDL 定义中似乎存在错误。(见下文)
例外:
com.sun.xml.internal.ws.server.ServerRtException: Cannot generate WSDL for binding "http://www.w3.org/2003/05/soap/bindings/HTTP/"
at com.sun.xml.internal.ws.server.EndpointFactory.generateWSDL(EndpointFactory.java:421)
at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:198)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:498)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:246)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:179)
at at.tac.ra.ng.bl.rainterface.webservice.WebServiceServer.startServer(WebServiceServer.java:140)
at at.tac.ra.ng.bl.rainterface.webservice.WebServiceServer.startInterface(WebServiceServer.java:182)
at at.tac.ra.ng.bl.rainterface.webservice.WebServiceServer$2.run(WebServiceServer.java:176)
at java.lang.Thread.run(Thread.java:722)
WSDL - 文件:
<wsdl:definitions xmlns:tns="http://system//system_EntryDataServices" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="system_EntryDataServices" targetNamespace="http://system//system_EntryDataServices">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://system//system_EntryDataServices" xmlns:SOAP_ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://system//system_EntryDataServices">
<xsd:complexType name="handleArrivalEntryUpdate">
<xsd:sequence>
<xsd:element name="UpdateEntry" nillable="true" type="tns:UpdateArrivalEntryRequest"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="UpdateArrivalEntryRequest">
<xsd:sequence>
<xsd:element name="ArrivalEntry" type="tns:ArrivalData" minOccurs="0"/>
<xsd:element name="MessageType" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrivalData">
<xsd:sequence>
<xsd:element name="Number1" type="xsd:string"/>
<xsd:element name="String1" type="xsd:string" minOccurs="0"/>
<xsd:element name="String2" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="handleArrivalEntryUpdateResponse">
<xsd:sequence>
<xsd:element name="ResultStatus" nillable="true" type="tns:ResultStatus"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ResultStatus">
<xsd:sequence>
<xsd:element name="Type" type="tns:Type"/>
<xsd:element name="Code" type="xsd:string"/>
<xsd:element name="Message" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="Type">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:enumeration value="S"/>
<xsd:enumeration value="E"/>
<xsd:enumeration value="W"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="handleDepartureEntryUpdate">
<xsd:sequence>
<xsd:element name="UpdateEntry" nillable="true" type="tns:UpdateDepartureEntryRequest"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="UpdateDepartureEntryRequest">
<xsd:sequence>
<xsd:element name="DepartureEntry" type="tns:DepartureData" minOccurs="0"/>
<xsd:element name="MessageType" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DepartureData">
<xsd:sequence>
<xsd:element name="Number1" type="xsd:string"/>
<xsd:element name="String1" type="xsd:string" minOccurs="0"/>
<xsd:element name="String2" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="handleDepartureEntryUpdateResponse">
<xsd:sequence>
<xsd:element name="ResultStatus" nillable="true" type="tns:ResultStatus"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="handleEntryDataReload">
<xsd:sequence>
<xsd:element name="EntryData" nillable="true" type="tns:EntryPlanRequest"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EntryPlanRequest">
<xsd:sequence>
<xsd:element name="ArrivalEntrys" type="tns:ArrayOfArrivalData" minOccurs="0"/>
<xsd:element name="DepartureEntrys" type="tns:ArrayOfDepartureData" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfArrivalData">
<xsd:sequence>
<xsd:element name="ArrayOfArrivalDataItem" type="tns:ArrivalData" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfDepartureData">
<xsd:sequence>
<xsd:element name="ArrayOfDepartureDataItem" type="tns:DepartureData" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="handleEntryDataReloadResponse">
<xsd:sequence>
<xsd:element name="ResultStatus" nillable="true" type="tns:ResultStatus"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="handleArrivalEntryUpdate" type="tns:handleArrivalEntryUpdate"/>
<xsd:element name="handleArrivalEntryUpdateResponse" type="tns:handleArrivalEntryUpdateResponse"/>
<xsd:element name="handleDepartureEntryUpdate" type="tns:handleDepartureEntryUpdate"/>
<xsd:element name="handleDepartureEntryUpdateResponse" type="tns:handleDepartureEntryUpdateResponse"/>
<xsd:element name="handleEntryDataReload" type="tns:handleEntryDataReload"/>
<xsd:element name="handleEntryDataReloadResponse" type="tns:handleEntryDataReloadResponse"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="system_EntryDataServices_PortType_handleEntryDataReload">
<wsdl:part name="parameters" element="tns:handleEntryDataReload">
</wsdl:part>
</wsdl:message>
<wsdl:message name="system_EntryDataServices_PortType_handleArrivalEntryUpdateResponse">
<wsdl:part name="parameters" element="tns:handleArrivalEntryUpdateResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="system_EntryDataServices_PortType_handleDepartureEntryUpdate">
<wsdl:part name="parameters" element="tns:handleDepartureEntryUpdate">
</wsdl:part>
</wsdl:message>
<wsdl:message name="system_EntryDataServices_PortType_handleEntryDataReloadResponse">
<wsdl:part name="parameters" element="tns:handleEntryDataReloadResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="system_EntryDataServices_PortType_handleDepartureEntryUpdateResponse">
<wsdl:part name="parameters" element="tns:handleDepartureEntryUpdateResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="system_EntryDataServices_PortType_handleArrivalEntryUpdate">
<wsdl:part name="parameters" element="tns:handleArrivalEntryUpdate">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="system_EntryDataServices_PortType">
<wsdl:operation name="handleArrivalEntryUpdate">
<wsdl:input message="tns:system_EntryDataServices_PortType_handleArrivalEntryUpdate">
</wsdl:input>
<wsdl:output message="tns:system_EntryDataServices_PortType_handleArrivalEntryUpdateResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="handleDepartureEntryUpdate">
<wsdl:input message="tns:system_EntryDataServices_PortType_handleDepartureEntryUpdate">
</wsdl:input>
<wsdl:output message="tns:system_EntryDataServices_PortType_handleDepartureEntryUpdateResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="handleEntryDataReload">
<wsdl:input message="tns:system_EntryDataServices_PortType_handleEntryDataReload">
</wsdl:input>
<wsdl:output message="tns:system_EntryDataServices_PortType_handleEntryDataReloadResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="system_common_adapters_ws_system_EntryDataServices_Binder" type="tns:system_EntryDataServices_PortType">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="handleArrivalEntryUpdate">
<soap12:operation soapAction="system_common_adapters_ws_system_EntryDataServices_Binder_handleArrivalEntryUpdate" style="document"/>
<wsdl:input>
<soap12:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="handleDepartureEntryUpdate">
<soap12:operation soapAction="system_common_adapters_ws_system_EntryDataServices_Binder_handleDepartureEntryUpdate" style="document"/>
<wsdl:input>
<soap12:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="handleEntryDataReload">
<soap12:operation soapAction="system_common_adapters_ws_system_EntryDataServices_Binder_handleEntryDataReload" style="document"/>
<wsdl:input>
<soap12:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="system_EntryDataServices">
<wsdl:port name="system_common_adapters_ws_system_EntryDataServices_Port" binding="tns:system_common_adapters_ws_system_EntryDataServices_Binder">
<soap12:address location="http://testsystem/ws/system.common.adapters.ws:system_EntryDataServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>