2009-12-17 70 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"/>