编辑我从下面给出的示例开始,但我现在有:
- 尝试了 W3C 规范中的示例。
StockQuoteSoapBinding
在修复另一个错误(在一个地方,另一个地方调用了绑定StockQuoteBinding
)之后,它给出了同样的问题。 - 尝试了单声道发生器
wsdl
,看看是否wsimport
是罪魁祸首。它给出了等效的错误。
所以在我看来,尽管 SOAP 大肆宣传,但它实际上并没有起作用——至少不像宣传的那样。我不敢相信没有人通过这些生成器运行最常见的 wsdl 示例。
原始问题
wsimport 在以下 wsdl 上失败:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="OrdersService"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:os="http://example/schema/OrdersService"
xmlns:tns="http://example/ns/OrdersService"
targetNamespace="http://example/ns/OrdersService"
>
<wsdl:types>
<xsd:schema
targetNamespace="http://example/schema/OrdersService">
<xsd:element name="o:GetOrders">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="criteria" type="string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="os:GetOrdersResponse">
<xsd:complexType>
<xsd:all>
<xsd:element name="orders" type="string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetOrdersRequest">
<wsdl:part name="parameters" element="os:GetOrders"/>
</wsdl:message>
<wsdl:message name="GetOrdersResponse">
<wsdl:part name="parameters" element="os:GetOrdersResponse"/>
</wsdl:message>
<wsdl:portType name="GetOrdersPortType">
<wsdl:operation name="GetOrders">
<wsdl:input message="tns:GetOrdersRequest"/>
<wsdl:output message="tns:GetOrdersResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GetOrdersBinding" type="tns:GetOrdersPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetOrders">
<soap:operation soapAction=""/>
<wsdl:input><soap:body use="literal"/></wsdl:input>
<wsdl:output><soap:body use="literal"/></wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrdersService">
<wsdl:port name="GetOrdersPort" binding="tns:GetOrdersBinding">
<soap:address location="http://localhost:8080/svc/OrdersService/GetOrders"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
和:
parsing WSDL...
[ERROR] Schema descriptor {http://example/schema/OrdersService}GetOrders in message part "parameters" is not defined and could not be bound to Java. Perhaps the schema descriptor {http://example/schema/OrdersService}GetOrders is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch.
line 35 of file:test.wsdl