【问题标题】:Error importing a WSDL in SoapUI在 SoapUI 中导入 WSDL 时出错
【发布时间】:2013-03-18 16:24:46
【问题描述】:

我在尝试创建新的 SoapUI 项目并为 Web 服务模拟导入 WSDL 时收到此消息。错误消息似乎不完整,因为它实际上并没有说明没有关闭哪个标签。

错误加载 [file:\C:\chad.wsdl]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: 错误: 不关闭标签

这是 WSDL:

    <wsdl:definitions name="Chad" targetNamespace="http://www.examples.com/wsdl/Chad.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.examples.com/wsdl/Chad.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

       <wsdl:message name="SayHiRequest">
          <wsdl:part name="text" type="xsd:string"/>
       </wsdl:message>
       <wsdl:message name="SayHiResponse">
          <wsdl:part name="text" type="xsd:string"/>
       </wsdl:message>

       <wsdl:portType name="Hello_PortType">
          <wsdl:operation name="sayHi">
             <wsdl:input message="tns:SayHiRequest"/>
             <wsdl:output message="tns:SayHiResponse"/>
          </wsdl:operation>
       </wsdl:portType>

       <wsdl:binding name="Hello_Binding" type="tns:Hello_PortType">
           <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
           <wsdl:operation name="sayHi">
              <soap:operation soapAction="sayHi"/>
              <wsdl:input>
                 <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
              </wsdl:input>
              <wsdl:output>
                 <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
              </wsdl:output>
           </wsdl:operation>
       </wsdl:binding>

       <wsdl:service name="Hello_Service">
          <wsdl:documentation>WSDL File for HelloService</documentation>
          <wsdl:port binding="tns:Hello_Binding" name="Hello_Port">
             <soap:address location="http://www.examples.com/chad/"/>
          </wsdl:port>
       </wsdl:service>
    </wsdl:definitions>

我的 WSDL 似乎验证了。

我在网上发现了一些类似的问题,其中 wsdl 是从 http url 导入的,并且导入会导致同样的错误,但我是直接从我的 C 驱动器导入(而不是通过 http),所以建议的解决方案没有工作。

【问题讨论】:

    标签: wsdl soapui


    【解决方案1】:

    以下行中存在命名空间问题

    原行

    <wsdl:documentation>WSDL File for HelloService</documentation>
    

    改为

    <wsdl:documentation>WSDL File for HelloService</wsdl:documentation>
    

    这是更新后的 wsdl

    <?xml version='1.0' encoding="UTF-8"?>
    <wsdl:definitions name="Chad" targetNamespace="http://www.examples.com/wsdl/Chad.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.examples.com/wsdl/Chad.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
           <wsdl:message name="SayHiRequest">
              <wsdl:part name="text" type="xsd:string"/>
           </wsdl:message>
           <wsdl:message name="SayHiResponse">
              <wsdl:part name="text" type="xsd:string"/>
           </wsdl:message>
    
           <wsdl:portType name="Hello_PortType">
              <wsdl:operation name="sayHi">
                 <wsdl:input message="tns:SayHiRequest"/>
                 <wsdl:output message="tns:SayHiResponse"/>
              </wsdl:operation>
           </wsdl:portType>
    
           <wsdl:binding name="Hello_Binding" type="tns:Hello_PortType">
               <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
               <wsdl:operation name="sayHi">
                  <soap:operation soapAction="sayHi"/>
                  <wsdl:input>
                     <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
                  </wsdl:input>
                  <wsdl:output>
                     <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
                  </wsdl:output>
               </wsdl:operation>
           </wsdl:binding>
    
           <wsdl:service name="Hello_Service">
              <wsdl:documentation>WSDL File for HelloService</wsdl:documentation>
              <wsdl:port binding="tns:Hello_Binding" name="Hello_Port">
                 <soap:address location="http://www.examples.com/chad/"/>
              </wsdl:port>
           </wsdl:service>
        </wsdl:definitions>
    

    【讨论】:

    【解决方案2】:

    我能够在soapUI 4.5.2 中加载WSDL,而不会出现您遇到的错误。虽然,我确实收到了以下错误。

    Tue Aug 20 11:30:21 ADT 2013:ERROR:Could not find element [{https://something.com/service/types}IsAvailableRequest] specified in part [parameters]
    

    【讨论】:

      【解决方案3】:

      我有同样的错误,但原因不同:

      Instead of:
      https://sitename.com/prefix/app/services.asxm 
      
      Use:   
      https://sitename.com/prefix/app/services.asxm?WSDL
      

      我以前没有使用过 SOAP,而且我在 url 中缺少 ?WSDL 并不是很明显。发布以防万一其他人有同样的问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-03-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多