gpt4 book ai didi

Java Webservice JAX WS 无法生成用于绑定(bind)的 WSDL "http://www.w3.org/2003/05/soap/bindings/HTTP/"

转载 作者:行者123 更新时间:2023-12-01 04:20:32 26 4
gpt4 key购买 nike

我使用 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/")

然后我就可以启动服务,但收到此警告:“为指定的绑定(bind)生成非标准 WSDL”警告本身不是问题,但是当我从外部客户端(例如soapUI)访问/导入已发布的WSDL时,请求格式错误并且无法工作。 (缺少元素)

WSDL 定义中似乎存在错误。(见下文)

异常(exception):

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>

最佳答案

在使用 wsimport 生成 wsdl 服务期间,我有 2 点对我有用

1) 您应该根据目标命名空间创建一个包,并在该路径中添加(或者 IDE 将添加——就像我的例子中的 netbeans)SEI。在您的情况下,包将是 system.system_EntryDataServices

2) 以上应该可以解决您的问题。如果您仍然遇到问题,就像我一样,一旦生成了 wsdl,那么您应该将 xsd 的引用包含在应用程序部署包中(war,ear)

关于Java Webservice JAX WS 无法生成用于绑定(bind)的 WSDL "http://www.w3.org/2003/05/soap/bindings/HTTP/",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18962825/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com