2015-09-14 47 views
0

我已經多次查看過這個wsdl,似乎無法找到問題。當我嘗試加載WSDL到的soapUI我得到以下的要求:Soapui沒有正確識別wsdl

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <parametersReq/> 
    </soapenv:Body> 
</soapenv:Envelope> 

但是這不是我想要的請求。我的xsd中沒有任何參數出現在soapui中。我在做什麼錯:

WSDL:

<?xml version="1.0"?> 



<wsdl:definitions name="MyService" targetNamespace="http://example.com/myService.wsdl" xmlns:proto="http://example.com/prototype.xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://example.com/myService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <wsdl:types> 
     <xsd:schema targetNamespace="http://example.com/prototype.xsd" xmlns:proto="http://example.com/prototype.xsd" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 

     <xsd:include schemaLocation="prototype.xsd"/> 
     </xsd:schema> 
    </wsdl:types> 
    <wsdl:message name="prototypeReqMessage"> 
     <wsdl:part element="parametersReq" name="proto:PrototypeRequest"/> 
    </wsdl:message> 
    <wsdl:message name="prototypeRespMessage"> 
     <wsdl:part element="parametersRes" name="proto:PrototypeResponse"/> 
    </wsdl:message> 
    <wsdl:portType name="MyPortType"> 
     <wsdl:operation name="invokeProto"> 
      <wsdl:input name="prototypeReqMessage" message="tns:prototypeReqMessage"/> 
      <wsdl:output name="prototypeRespMessage" message="tns:prototypeRespMessage"/> 
     </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="MyBinding" type="tns:MyPortType"> 
     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
     <wsdl:operation name="invokeProto"> 
      <soap:operation soapAction="urn:MyService" style="document"/> 
      <wsdl:input name="prototypeReqMessage"> 
       <soap:body use="literal"/> 
      </wsdl:input> 
      <wsdl:output name="prototypeRespMessage"> 
       <soap:body use="literal"/> 
      </wsdl:output> 
     </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="MyService"> 
     <wsdl:documentation>My first service</wsdl:documentation> 
     <wsdl:port binding="tns:MyBinding" name="MyPort"> 
      <soap:address location="http://localhost/example.com/myService"/> 
     </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

XSD:

<?xml version="1.0" encoding="UTF-8"?> 

<xsd:schema targetNamespace="http://example.com/prototype.xsd" xmlns:tns="http://example.com/prototype.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:temp="http://example.com/temporary.xsd" elementFormDefault="qualified"> 
    <xsd:import namespace="http://example.com/temporary.xsd" schemaLocation="com/example/temporary.xsd"/> 
    <xsd:element name="PrototypeRequest"> 
     <xsd:complexType> 
      <xsd:sequence> 
       <xsd:element name="Person" type="xsd:string"/> 
       <xsd:element name="Car" type="tns:CarType"/> 
      </xsd:sequence> 
     </xsd:complexType> 
    </xsd:element> 
    <xsd:element name="PrototypeResponse"> 
     <xsd:complexType> 
      <xsd:sequence> 
       <xsd:element name="protoResp" type="xsd:string" default="Hello_World"/> 
      </xsd:sequence> 
     </xsd:complexType> 
    </xsd:element> 
    <xsd:complexType name="CarType"> 
     <xsd:sequence> 
      <xsd:element name="Honda" type="xsd:string"/> 
      <xsd:element name="Toyota" type="xsd:string"/> 
      <xsd:element name="Ford" type="xsd:string"/> 
      <xsd:element name="Mercedez" type="xsd:string"/> 
     </xsd:sequence> 
    </xsd:complexType> 
</xsd:schema> 

感謝。

回答

1

您的WSDL無效。

您需要重寫消息定義;對於例如爲:

<wsdl:message name="prototypeReqMessage"> 
    <wsdl:part element="parametersReq" name="proto:PrototypeRequest"/> 
</wsdl:message> 

進入這個:

<wsdl:message name="prototypeReqMessage"> 
    <wsdl:part element="proto:PrototypeRequest" name="parametersReq"/> 
</wsdl:message> 

元素屬性在WSDL:部分必須指向你的架構中定義的元素的全名。

+0

謝謝你這是我做錯了。 – ManofSteel