我多次查看过此wsdl并且似乎无法找到问题。当我尝试将wsdl加载到soapui时,我得到以下内容作为请求:
<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>
感谢。
答案 0 :(得分:1)
Your WSDL is invalid.
You need to rewrite your message definitions; for e.g.:
<wsdl:message name="prototypeReqMessage">
<wsdl:part element="parametersReq" name="proto:PrototypeRequest"/>
</wsdl:message>
Into this:
<wsdl:message name="prototypeReqMessage">
<wsdl:part element="proto:PrototypeRequest" name="parametersReq"/>
</wsdl:message>
The element attribute in wsdl:part must point to the fully qualified name of the element defined by your schema.