在SoapUI中导入WSDL时出错

时间:2013-03-18 16:24:46

标签: wsdl soapui

尝试创建新的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似乎验证了。

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

2 个答案:

答案 0 :(得分:2)

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

原帖

<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>

答案 1 :(得分:0)

我能够在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]