2009-12-17 68 views
3

我遇到的問題是,當我嘗試使用此wsdl在netbeans中創建Web服務時,netbeans說沒有定義服務。我是新手,但據我所知,有一個定義。從WSDL創建Web服務時出現問題

的WSDL是:

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://discoveryinsurance.com/DicQuoteSvc/AgencyQuote.wsdl" xmlns:ns="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRq.xsd" xmlns:na="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRs.xsd" targetNamespace="http://discoveryinsurance.com/DicQuoteSvc/AgencyQuote.wsdl"> 
<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRq.xsd"/> 
<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRs.xsd"/> 
<wsdl:types> 
    <xs:schema targetNamespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" elementFormDefault="qualified"/> 
</wsdl:types> 
<wsdl:message name="NewMessageRequest"> 
    <wsdl:part name="parameter" element="ns:ACORD"/> 
</wsdl:message> 
<wsdl:message name="NewMessageResponse"> 
    <wsdl:part name="parameter" element="na:ACORD"/> 
</wsdl:message> 
<wsdl:portType name="QuotePortType"> 
    <wsdl:operation name="RequestQuote"> 
     <wsdl:input message="tns:NewMessageRequest"/> 
     <wsdl:output message="tns:NewMessageResponse"/> 
    </wsdl:operation> 
</wsdl:portType> 
<wsdl:binding name="QuoteBinding" type="tns:QuotePortType"> 
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <wsdl:operation name="RequestQuote"> 
     <soap:operation soapAction="http://discoveryinsurance.com/DicQuoteSvc/AgencyQuote" style="rpc"/> 
     <wsdl:input> 
      <soap:body use="literal"/> 
     </wsdl:input> 
     <wsdl:output> 
      <soap:body use="literal"/> 
     </wsdl:output> 
    </wsdl:operation> 
</wsdl:binding> 
<wsdl:service name="AgencyQuote"> 
    <wsdl:port name="QuotePortType" binding="tns:QuoteBinding"> 
     <soap:address location="http://discoveryinsurance.com/DicQuoteSvc/"/> 
    </wsdl:port> 
</wsdl:service> 

XMLSpy的說,WSDL是有效的,但是當我試圖從它創建Web服務失敗。 任何幫助,將不勝感激,甚至建設性的批評。

編輯

從條命令行,我得到使用的wsimport。

[ERROR]無效的wsdl:操作 「RequestQuote」:其rpc-文字操作,MES 鼠尾草部分必須引用架構類型聲明文件的 第16行:/ d:/項目/ DICACORD/QuoteRq2 .wsdl

這是否意味着即使兩個xsd被導入,我仍然必須在wsdl中定義類型?

更新2

用於請求 - 架構>。 Schema at pastie

加成

有誰看到什麼不對的XSD進口和/或它們是如何被使用?驗證WSDL是有效

+0

你工作的是什麼框架。Spring使這非常簡單。 – Zoidberg 2009-12-17 19:35:38

+0

ALSO,你的XSD在哪裏? (模式) – Zoidberg 2009-12-17 19:44:04

+0

模式每個都超過250行。它會允許我發佈那些大嗎? – ChadNC 2009-12-17 20:18:08

回答

1

要回答我的問題,Web服務是原因未能從wsdl創建是由於使用了wsdl:import而不是xs:import

我不知道它,但在做了一些更多的研究之後,似乎應該在您要導入另一個wsdl時使用wsdl:import,但是如果要從a中導入架構以使用其中定義的類型您需要使用wsdl xsd:import,因爲如果不是wsimport將找不到架構中定義的類型。

我改變

xmlns:ns="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRq.xsd" 
xmlns:na="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRs.xsd" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 

xmlns:rq="http://discoveryinsurance.com/DicQuoteSvc/schemas/request/" 
xmlns:rs="http://discoveryinsurance.com/DicQuoteSvc/schemas/response/" 

,改變了進口

<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRq.xsd"/> 
<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRs.xsd"/> 

<xs:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/request/" schemaLocation="DicAcordQuoteRq.xsd"/> 
<xs:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/response/" schemaLocation="DicAcordQuoteRs.xsd"/> 

進行這些更改允許Web服務成功構建,並且根據兩個模式創建類。希望當我在星期一開始測試Web服務時,它將按我的意願工作。感謝你們提供的所有輸入信息,因爲它讓我瞭解了爲什麼從wsdl創建Web服務失敗的原因。

我確實改變了它們所在的名稱空間,但這是出於不同的原因,並且在我的機器上本地創建並部署了Web服務後,我做了這些。

節日快樂大家。

5

最簡單方法是運行命令行:

wsimport yourservice.wsdl 

,看看它給你任何錯誤。 wsimport自帶JDK 1.6

您提交的WSDL並不完整,因爲它具有對外部模式文件(XSD)的引用,所以我無法驗證它。

0

ACORD在命名空間http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRq.xsd中。

在我看來,你的ACORD的進口是無效的,因爲它是識別ACORD的命名空間是不同的:

<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRq.xsd"/>