Eclipse 中的 WSDL 验证命名空间失败

WSDL validation in Eclipse fails for namespace

我已经制作了一个 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 的列表(列)和 return 基于这些 ID 的 2 列 table 数据。

你能帮我找出问题所在吗?

Eclipse Java 面向 Web 开发人员的 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 没有问题。至少补丁,前面提到的修复了一些东西。

回答

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

一般规则

  1. 创建 SOAP 服务时,请定义您需要的 input/output XSD 模式

  2. 在输入中使用架构,您需要使用 IDE/Maven/any 构建工具生成 WSDL 文件。

  3. 为了更简单manipulations/Edits,请选择 Eclipse WSDL Editor。