我承认在WSDL方面我是无知的。我为我正在处理的项目提供了以下WSDL,但它无法正常工作。这是我正在使用的WSDL的帖子。我被要求从wsdl中删除服务的实际URL,以便它不会被爬行器索引和命中。实际的网址已被“www.testsite.org”取代。这是XML:
<wsdl:definitions xmlns:tns="https://www.testsite.org/uiws-test" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="uiicon" targetNamespace="https://www.testsite.org/uiws-test">
<!-- TYPES -->
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="https://www.testsite.org/uiws-test">
<xsd:complexType name="ResponseType">
<xsd:sequence>
<xsd:element name="request_id" type="xsd:string"/>
<xsd:element name="messages" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="responseType" type="tns:ResponseType"/>
<xsd:element name="ICON_MessageTrain" type="xsd:string"/>
<xsd:element name="fault" type="xsd:string"/>
</xsd:schema>
</wsdl:types>
<!-- MESSAGES -->
<wsdl:message name="RequestMessage">
<wsdl:part name="ICON_MessageTrain" element="tns:ICON_MessageTrain"/>
</wsdl:message>
<wsdl:message name="ResponseMessage">
<wsdl:part name="response" element="tns:responseType"/>
</wsdl:message>
<wsdl:message name="FaultMessage">
<wsdl:part name="fault" element="tns:fault"/>
</wsdl:message>
<wsdl:message name="SourceHeader">
<wsdl:part name="source" element="xsd:string"/>
</wsdl:message>
<wsdl:message name="ApplicationHeader">
<wsdl:part name="application" element="xsd:string"/>
</wsdl:message>
<!-- PORT TYPES -->
<wsdl:portType name="uiicon_portType">
<wsdl:operation name="uiicon">
<wsdl:input message="tns:RequestMessage"/>
<wsdl:output message="tns:ResponseMessage"/>
<wsdl:fault message="tns:FaultMessage" name="FaultMessage"/>
</wsdl:operation>
</wsdl:portType>
<!-- BINDINGS -->
<wsdl:binding name="uiicon_binding" type="tns:uiicon_portType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="uiicon">
<soap:operation soapAction="https://www.testsite.org/uiws-test/services/uiicon-test" style="document"/>
<wsdl:input>
<soap:header part="source" message="tns:SourceHeader" use="literal"/>
<soap:header part="application" message="tns:ApplicationHeader" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="FaultMessage">
<soap:fault name="FaultMessage" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<!-- SERVICES -->
<wsdl:service name="uiicon_service">
<wsdl:documentation>
This is the web service for UI-ICON data exchange modernization project
</wsdl:documentation>
<wsdl:port name="uiicon_port" binding="tns:uiicon_binding">
<soap:address location="https://www.testsite.org/uiws-test/services/uiicon-test"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
当我在wsdl.exe中运行时,出现以下错误:
我看到wsdl引用w3.org 2001模式的位置,我看到了字符串模式引用。只是不确定它应该是什么样子以及它为什么是错误的。谢谢!
答案 0 :(得分:3)
如果您在element
和type
引用中将SourceHeader
更改为ApplicationHeader
,则WSDL有效,即:
<wsdl:message name="ApplicationHeader">
<wsdl:part name="application" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="SourceHeader">
<wsdl:part name="source" type="xsd:string"/>
</wsdl:message>
使用element
,您可以引用预定义的简单或复杂类型。但是,您可以在此定义一个类型为xsd:string
的新元素(称为应用程序/源)。因此,您需要使用type
。
据我所知,您只需要一个名为application的单个消息部分,其中包含一个字符串。修复应该使这个工作和WSDL有效。我不能保证实际的Web服务将接受/发送什么,因为它的描述无效,但是......
答案 1 :(得分:1)
我认为这并不像公认的答案那样干脆。
根据我对WSDL 1.1 spec, section 2.3.1 Message Parts的阅读,这个WSDL应该是有效的。
我的理解是,确定是否应该使用元素或类型的关键项之一是基于绑定样式 - rpc与文档,文字与编码。 An answer to a similar question更详细,article that the answer references。
由于这个WSDL确实使用了文档/文字绑定,在我看来,使用element over type是正确的。