W3C WSDL 1.1 仕様の「例 1」のスタブを取得wsimport
または Apache CXFで生成しようとしています。(また、投稿の最後に逐語的にコピーされました)。wsdl2java
この例には小さなタイプミスがあるように見えますが、置き換えた後でも:
binding="tns:StockQuoteBinding
と
binding="tns:StockQuoteSoapBinding
wsimportとwsdl2javaの両方がまだ失敗します。
コマンド ライン バージョン (JAX-WS RI 2.2.4) と Ant タスク バージョン (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 CXFwsdl2java
は、わずかに異なるメッセージで同じタイプについて文句を言います)
この 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>