WCF服务引用为SOAP 1.1生成代码,而不是为SOAP1.2生成代码

时间:2015-05-21 08:39:43

标签: wcf soap wsdl svcutil.exe wsdl.exe

我收到了一个WSDL,其中包含SOAP 1.1和& S的引用。 SOAP 1.2,因为服务器同时支持SOAP 1.1& 1.2

但是,我想将SOAP 1.2用于我的客户目的。但是当我尝试使用Visual Studio生成服务引用时,它只生成1.1的引用。有没有办法强制生成1.2参考?

以下是我收到的wsdl:

<wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:element name="MyTestInfo">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="SirName" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="MyTestInfoResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="MyTestInfoResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="MyTestInfoSoapIn">
    <wsdl:part name="parameters" element="tns:MyTestInfo" />
  </wsdl:message>
  <wsdl:message name="MyTestInfoSoapOut">
    <wsdl:part name="parameters" element="tns:MyTestInfoResponse" />
  </wsdl:message>
  <wsdl:portType name="MyTestSoap">
    <wsdl:operation name="MyTestInfo">
      <wsdl:input message="tns:MyTestInfoSoapIn" />
      <wsdl:output message="tns:MyTestInfoSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="MyTestSoap" type="tns:MyTestSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="MyTestInfo">
      <soap:operation soapAction="http://tempuri.org/MyTestInfo" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="MyTestSoap12" type="tns:MyTestSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="MyTestInfo">
      <soap12:operation soapAction="http://tempuri.org/MyTestInfo" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="MyTest">
    <wsdl:port name="MyTestSoap" binding="tns:MyTestSoap">
      <soap:address location="http://testServer.com/MyTest.asmx" />
    </wsdl:port>
    <wsdl:port name="MyTestSoap12" binding="tns:MyTestSoap12">
      <soap12:address location="http://testServer/MyTest.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

0 个答案:

没有答案