Web services WSDL绑定是可选的吗?

Web services WSDL绑定是可选的吗?,web-services,soap,wsdl,Web Services,Soap,Wsdl,我有一个wsdl文件,没有绑定部分: <?xml version="1.0" encoding="utf-8" standalone="no"?> <wsdl:definitions xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xml

我有一个wsdl文件,没有绑定部分:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<wsdl:definitions xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Engage" targetNamespace="http://tempuri.org/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/">
  <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <xs:element name="OtherData">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="OtherDataResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="OtherDataResult" nillable="true" type="xs:string" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="MyData">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="MyDataResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="MyDataResult" nillable="true" type="xs:string" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
      <xs:element name="anyType" nillable="true" type="xs:anyType" />
      <xs:element name="anyURI" nillable="true" type="xs:anyURI" />
      <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
      <xs:element name="boolean" nillable="true" type="xs:boolean" />
      <xs:element name="byte" nillable="true" type="xs:byte" />
      <xs:element name="dateTime" nillable="true" type="xs:dateTime" />
      <xs:element name="decimal" nillable="true" type="xs:decimal" />
      <xs:element name="double" nillable="true" type="xs:double" />
      <xs:element name="float" nillable="true" type="xs:float" />
      <xs:element name="int" nillable="true" type="xs:int" />
      <xs:element name="long" nillable="true" type="xs:long" />
      <xs:element name="QName" nillable="true" type="xs:QName" />
      <xs:element name="short" nillable="true" type="xs:short" />
      <xs:element name="string" nillable="true" type="xs:string" />
      <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
      <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
      <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
      <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
      <xs:element name="char" nillable="true" type="tns:char" />
      <xs:simpleType name="char">
        <xs:restriction base="xs:int" />
      </xs:simpleType>
      <xs:element name="duration" nillable="true" type="tns:duration" />
      <xs:simpleType name="duration">
        <xs:restriction base="xs:duration">
          <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
          <xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
          <xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
        </xs:restriction>
      </xs:simpleType>
      <xs:element name="guid" nillable="true" type="tns:guid" />
      <xs:simpleType name="guid">
        <xs:restriction base="xs:string">
          <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
        </xs:restriction>
      </xs:simpleType>
      <xs:attribute name="FactoryType" type="xs:QName" />
      <xs:attribute name="Id" type="xs:ID" />
      <xs:attribute name="Ref" type="xs:IDREF" />
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="IMyService_OtherData_InputMessage">
    <wsdl:part element="tns:OtherData" name="parameters" />
  </wsdl:message>
  <wsdl:message name="IMyService_OtherData_OutputMessage">
    <wsdl:part element="tns:OtherDataResponse" name="parameters" />
  </wsdl:message>
  <wsdl:message name="IMyService_MyData_InputMessage">
    <wsdl:part element="tns:MyData" name="parameters" />
  </wsdl:message>
  <wsdl:message name="IMyService_MyData_OutputMessage">
    <wsdl:part element="tns:MyDataResponse" name="parameters" />
  </wsdl:message>
  <wsdl:portType name="IMyService">
    <wsdl:operation name="OtherData">
      <wsdl:input message="tns:IMyService_OtherData_InputMessage" wsaw:Action="http://tempuri.org/IMyService/OtherData" />
      <wsdl:output message="tns:IMyService_OtherData_OutputMessage" wsaw:Action="http://tempuri.org/IMyService/OtherDataResponse" />
    </wsdl:operation>
    <wsdl:operation name="MyData">
      <wsdl:input message="tns:IMyService_MyData_InputMessage" wsaw:Action="http://tempuri.org/IMyService/MyData" />
      <wsdl:output message="tns:IMyService_MyData_OutputMessage" wsaw:Action="http://tempuri.org/IMyService/MyDataResponse" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:service name="MyService">
    <wsdl:port name="xmlPort">
      <http:address location="http://localhost:59109/MyService.svc/xml" />
    </wsdl:port>
    <wsdl:port name="jsonPort">
      <http:address location="http://localhost:59109/MyService.svc/json" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

这个wsdl有效吗?或者换句话说,我们可以有没有绑定部分的wsdl,或者它是必需的,而这个wsdl是无效的?一些工具(如SoapUI)抛出异常,但另一个(如此)表示这是有效的wsdl。

根据:

给定端口类型可能有任意数量的绑定

这是否意味着不能有绑定? 好的,看看WSDL1.1的XML模式,绑定元素可能根本不存在


实际行为可能取决于SOAP库。请注意,绑定指定是使用文档还是RFC样式调用,以及是否对数据进行编码。

由于其他原因,它肯定是无效的。
tns:IMyService\u OtherData\u InputMessage
消息在哪里?这是我的错误(我手动更改了一些名称,但忘记了这个名称)。现在应该是正确的。但是仍然有一个关于缺少绑定的问题,这是真的,但是根据这个模式,当我们有service->port元素时,有一个必需的绑定属性,所以似乎在wsdl文件中有service部分,那么也必须有binding部分