Я пытаюсь заставить wsimport
или Apache CXF wsdl2java
генерировать заглушки для «Примера 1» спецификации W3C WSDL 1.1. а>. (также скопировано дословно в конце поста).
В примере есть небольшая опечатка, но даже после замены:
binding="tns:StockQuoteBinding
с
binding="tns:StockQuoteSoapBinding
и wsimport, и wsdl2java по-прежнему не работают.
Я пробовал версию командной строки (JAX-WS RI 2.2.4) и версию Ant Task (JAX-WS RI 2.2.8) wsimport
, а также версию Apache CXF wsdl2java
(2.7.6) для командной строки. . Все они, кажется, терпят неудачу по одной и той же причине более или менее:
$ wsimport -version
JAX-WS RI 2.2.4-b01
$ wsimport -d src-auto-wsimport/ -p foo.client -Xnocompile specs/example1.wsdl
parsing WSDL...
[ERROR] Schema descriptor {http://example.com/stockquote.xsd}TradePriceRequest in message part "body" is not defined and could not be bound to Java. Perhaps the schema descriptor {http://example.com/stockquote.xsd}TradePriceRequest 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 31 of file:/home/brutus/jax-ws/wsdl/specs/example1.wsdl
Из того, что я вижу, тип, на который он жалуется (TradePriceRequest
), правильно определен в схеме, предоставленной внутри файла WSDL, поэтому я не понимаю, почему он не может его найти. (Apache CXF wsdl2java
также жалуется на тот же тип в немного другом сообщении)
Любые идеи о том, что не так с этим файлом WSDL?
пример 1 WSDL (дословно из спецификации W3C WSDL 1.1, указанной выше)
Примечание: вам нужно изменить binding="tns:StockQuoteBinding
на binding="tns:StockQuoteSoapBinding
<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote.wsdl"
xmlns:tns="http://example.com/stockquote.wsdl"
xmlns:xsd1="http://example.com/stockquote.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="http://example.com/stockquote.xsd"
xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="TradePriceRequest">
<complexType>
<all>
<element name="tickerSymbol" type="string"/>
</all>
</complexType>
</element>
<element name="TradePrice">
<complexType>
<all>
<element name="price" type="float"/>
</all>
</complexType>
</element>
</schema>
</types>
<message name="GetLastTradePriceInput">
<part name="body" element="xsd1:TradePriceRequest"/>
</message>
<message name="GetLastTradePriceOutput">
<part name="body" element="xsd1:TradePrice"/>
</message>
<portType name="StockQuotePortType">
<operation name="GetLastTradePrice">
<input message="tns:GetLastTradePriceInput"/>
<output message="tns:GetLastTradePriceOutput"/>
</operation>
</portType>
<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetLastTradePrice">
<soap:operation soapAction="http://example.com/GetLastTradePrice"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="StockQuoteService">
<documentation>My first service</documentation>
<port name="StockQuotePort" binding="tns:StockQuoteBinding">
<soap:address location="http://example.com/stockquote"/>
</port>
</service>
</definitions>