jax-ws :: wsimport และ Apache CXF wsdl2java ล้มเหลวในตัวอย่างข้อกำหนด W3C WSDL เชิงบรรทัดฐาน

ฉันกำลังพยายามรับ wsimport หรือ Apache CXF wsdl2java สร้าง stubs สำหรับ "ตัวอย่าง 1" ของ W3C WSDL 1.1 spec. (คัดลอกคำต่อคำไว้ท้ายโพสต์ด้วย)

ตัวอย่างดูเหมือนจะมีการพิมพ์ผิดเล็กน้อย แต่หลังจากเปลี่ยนแล้ว:

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>

person Marcus Junius Brutus    schedule 23.09.2013    source แหล่งที่มา
comment
เป็นไปได้ที่ซ้ำกันของ WSDL หรือ wsimport และ wsdl (โมโน) พังทลายอย่างน่ากลัว   -  person Paul Sweatte    schedule 21.05.2014