【问题标题】:WSDL validation in Eclipse fails for namespaceEclipse 中的 WSDL 验证对命名空间失败
【发布时间】:2016-04-11 08:06:34
【问题描述】:

我已经制作了一个 WSDL 文件,我打算用它创建自顶向下的 Web 服务。不幸的是,Eclipse 抛出了这个错误:

"A problem occurred while running the WSDL validator for namespace http://schemas.xmlsoap.org/wsdl/"

我进行了一些研究,看起来这是因为一些 Eclipse wsdl-validation 错误,here 解释说

那里有人声称他用补丁修复了这个错误,我已经应用了它,但是错误仍然存​​在,我开始认为我的 wsdl 文件本身存在一些问题。

WebService 应该获取一个 ID 列表(列)并根据这些 ID 返回一个 2 列表数据。

你能帮我看看有什么问题吗?

面向 Web 开发人员的 Eclipse Java EE IDE。 版本:Mars.2 版本 (4.5.2) 版本号:20160218-0600 WTP 1.2.1.20150819-2220

这是 WSDL 文件:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
  targetNamespace="reb.ecm.ws.RebUtilsService"
        xmlns="reb.ecm.ws.RebUtilsService"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
        xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">


    <wsdl:types>
      <xsd:complexType name='DPList'>
        <xsd:element
          minOccurs='0'
          maxOccurs='unbounded'
          name='DP'
          type='DP'/>
      </xsd:complexType>
      <xsd:complexType name='DP'>
        <xsd:all>
          <xsd:element
            minOccurs='0'
            maxOccurs='1'
            name='DPID'
            type='xsd:int'/>
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name='WSInfoList'>
        <xsd:element
          minOccurs='0'
          maxOccurs='unbounded'
          name='WSInfoItem'
          type='WSInfoItem'/>
      </xsd:complexType>
      <xsd:complexType name='WSInfoItem'>
        <xsd:all>
          <xsd:element
            minOccurs='0'
            maxOccurs='1'
            name='DPID'
            type='xsd:int'/>
        </xsd:all>
        <xsd:all>
          <xsd:element
            minOccurs='0'
            maxOccurs='1'
            name='WSID'
            type='xsd:int'/>
        </xsd:all>
      </xsd:complexType>
    </wsdl:types>

    <wsdl:message name="inMessage">
        <wsdl:part name="DPList" type="DPList" />
    </wsdl:message>

    <wsdl:message name="outMessage">
        <wsdl:part name="WSInfoList" type="WSInfoList" />
    </wsdl:message>
    <wsdl:portType name="RebUtilsServicePortType">
        <wsdl:operation name="GetActualWSIDbyDPID"  >
            <wsdl:input message="inMessage" />
            <wsdl:output message="outMessage" />
        </wsdl:operation>
                    </wsdl:portType>

    <wsdl:binding name="RebUtilsServiceHTTPBinding" 
            type="RebUtilsServicePortType">
        <wsdlsoap:binding style="document" 
            transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetActualWSIDbyDPID">
            <wsdlsoap:operation soapAction=""/>
             <wsdl:input>
                <wsdlsoap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <wsdlsoap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="RebUtilsServicePorts">
        <wsdl:port binding="RebUtilsServiceHTTPBinding"  name="RebUtilsService">
            <wsdlsoap:address 
                location="http://localhost:9084/RebUtilsService/RebUtilsServicePorts"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

更新:Eclipse 没有问题。至少前面提到的补丁修复了一些问题。

【问题讨论】:

  • 您能告诉我们您使用的是哪个版本的eclipse吗?另外请从 Eclipse Marketplace 安装 Eclipse WSDL 验证插件并尝试重新生成您的客户端代码?
  • 面向 Web 开发人员的 Eclipse Java EE IDE。版本:Mars.2 Release (4.5.2) Build id:20160218-0600 WTP 1.2.1.20150819-2220
  • 您能否发布一个指向 WSDL 验证插件的链接,因为我在运行 Eclipse 市场时遇到了问题,因为我的组织中的代理设置。
  • 在您的架构定义中显示一些错误,您能发布您的架构吗?
  • 没有架构,我已经在 中输入了我需要的所有内容。我认为这样就足够了。

标签: java eclipse web-services soap wsdl


【解决方案1】:

回答

  1. 您的架构未正确定义。请看下图。
  2. 请将其更改为在架构定义中定义的更正数据类型元素,请在 Eclipse WSDL 设计视图中进行更改。
  3. 重新生成您的客户端并告知结果。
  4. 您应该有单独的 XSD 架构文件,并且应该根据您的要求进行映射,这就是它失败的原因,请查看分解的设计视图。

一般规则

  1. 在创建 SOAP 服务时,请定义所需的输入/输出 XSD 架构

  2. 使用模式作为输入,您需要使用 IDE/Maven/任何构建工具生成 WSDL 文件。

  3. 为了便于操作/编辑,请选择 Eclipse WSDL 编辑器。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-10
    • 2021-06-27
    • 1970-01-01
    • 2015-03-16
    • 2012-03-07
    • 2020-04-07
    • 1970-01-01
    相关资源
    最近更新 更多