none
Após migração de Framework cliente WCF recebe contract mismatch error RRS feed

  • Pergunta

  • Bom dia

    Migramos uma aplicação WCF  do .NET Framework 3.5 para o 4.6.2. Não mexemos em nenhum método exposto para os clientes. Porém os clientes passaram a receber erro de contract mismatch. Ao examinar os wsdl descriptions, notei diversas diferenças. Na versão antiga são gerados 2 arquivos wsdl ao criar uma referência no cliente, enquanto na nova versão gera apenas 1. Alguns namespaces mudaram (foram para o default tempuri.org). Segue abaixo assinaturas :

    VS 2010 (2 arquivos)

    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://portal.itau-unibanco/by5/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CalculadoraRCP" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:import namespace="http://portal.itau-unibanco/by5/" location="http://localhost:2222/by5/CalculadoraRCP.svc?wsdl=wsdl0" />
      <wsdl:types />
      <wsdl:binding name="BasicHttpBinding_ICalculadoraRCP" type="i0:ICalculadoraRCP">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="Calcular">
          <soap:operation soapAction="http://portal.itau-unibanco/by5/Calcular" style="document" />
          <wsdl:input>
            <soap:header message="i0:ICalculadoraRCP_Calcular_InputMessage_Headers" part="ServiceHeader" use="literal" />
            <soap:body use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="ListarSuitability">
          <soap:operation soapAction="http://portal.itau-unibanco/by5/ListarSuitability" style="document" />
          <wsdl:input>
            <soap:header message="i0:ICalculadoraRCP_ListarSuitability_InputMessage_Headers" part="ServiceHeader" use="literal" />
            <soap:body use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="CalculadoraRCP">
        <wsdl:port name="BasicHttpBinding_ICalculadoraRCP" binding="tns:BasicHttpBinding_ICalculadoraRCP">
          <soap:address location="http://localhost:2222/by5/CalculadoraRCP.svc" />
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>

    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://portal.itau-unibanco/by5/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://portal.itau-unibanco/by5/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
        <xsd:schema targetNamespace="http://portal.itau-unibanco/by5/Imports">
          <xsd:import schemaLocation="http://localhost:2222/by5/CalculadoraRCP.svc?xsd=xsd0" namespace="http://portal.itau-unibanco/by5/" />
          <xsd:import schemaLocation="http://localhost:2222/by5/CalculadoraRCP.svc?xsd=xsd1" namespace="http://localhost/by5/" />
        </xsd:schema>
      </wsdl:types>
      <wsdl:message name="ICalculadoraRCP_Calcular_InputMessage">
        <wsdl:part name="parameters" element="tns:Calcular" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_Calcular_InputMessage_Headers">
        <wsdl:part xmlns:q1="http://localhost/by5/" name="ServiceHeader" element="q1:ServiceHeader" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_Calcular_OutputMessage">
        <wsdl:part name="parameters" element="tns:CalcularResponse" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_ListarSuitability_InputMessage">
        <wsdl:part name="parameters" element="tns:ListarSuitability" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_ListarSuitability_InputMessage_Headers">
        <wsdl:part xmlns:q2="http://localhost/by5/" name="ServiceHeader" element="q2:ServiceHeader" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_ListarSuitability_OutputMessage">
        <wsdl:part name="parameters" element="tns:ListarSuitabilityResponse" />
      </wsdl:message>
      <wsdl:portType name="ICalculadoraRCP">
        <wsdl:operation name="Calcular">
          <wsdl:input wsaw:Action="http://portal.itau-unibanco/by5/Calcular" message="tns:ICalculadoraRCP_Calcular_InputMessage" />
          <wsdl:output wsaw:Action="http://portal.itau-unibanco/by5/ICalculadoraRCP/CalcularResponse" message="tns:ICalculadoraRCP_Calcular_OutputMessage" />
        </wsdl:operation>
        <wsdl:operation name="ListarSuitability">
          <wsdl:input wsaw:Action="http://portal.itau-unibanco/by5/ListarSuitability" message="tns:ICalculadoraRCP_ListarSuitability_InputMessage" />
          <wsdl:output wsaw:Action="http://portal.itau-unibanco/by5/ICalculadoraRCP/ListarSuitabilityResponse" message="tns:ICalculadoraRCP_ListarSuitability_OutputMessage" />
        </wsdl:operation>
      </wsdl:portType>
    </wsdl:definitions>

    VS2015 (1 arquivo)

    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CalculadoraRCP" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
        <xsd:schema targetNamespace="http://tempuri.org/Imports">
          <xsd:import schemaLocation="http://localhost:2222/by5/CalculadoraRCP.svc?xsd=xsd0" namespace="http://tempuri.org/" />
          <xsd:import schemaLocation="http://localhost:2222/by5/CalculadoraRCP.svc?xsd=xsd1" namespace="http://localhost/by5/" />
        </xsd:schema>
      </wsdl:types>
      <wsdl:message name="ICalculadoraRCP_Calcular_InputMessage">
        <wsdl:part name="parameters" element="tns:Calcular" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_Calcular_InputMessage_Headers">
        <wsdl:part xmlns:q1="http://localhost/by5/" name="ServiceHeader" element="q1:ServiceHeader" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_Calcular_OutputMessage">
        <wsdl:part name="parameters" element="tns:CalcularResponse" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_ListarSuitability_InputMessage">
        <wsdl:part name="parameters" element="tns:ListarSuitability" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_ListarSuitability_InputMessage_Headers">
        <wsdl:part xmlns:q2="http://localhost/by5/" name="ServiceHeader" element="q2:ServiceHeader" />
      </wsdl:message>
      <wsdl:message name="ICalculadoraRCP_ListarSuitability_OutputMessage">
        <wsdl:part name="parameters" element="tns:ListarSuitabilityResponse" />
      </wsdl:message>
      <wsdl:portType name="ICalculadoraRCP">
        <wsdl:operation name="Calcular">
          <wsdl:input wsaw:Action="http://tempuri.org/ICalculadoraRCP/Calcular" message="tns:ICalculadoraRCP_Calcular_InputMessage" />
          <wsdl:output wsaw:Action="http://tempuri.org/ICalculadoraRCP/CalcularResponse" message="tns:ICalculadoraRCP_Calcular_OutputMessage" />
        </wsdl:operation>
        <wsdl:operation name="ListarSuitability">
          <wsdl:input wsaw:Action="http://tempuri.org/ICalculadoraRCP/ListarSuitability" message="tns:ICalculadoraRCP_ListarSuitability_InputMessage" />
          <wsdl:output wsaw:Action="http://tempuri.org/ICalculadoraRCP/ListarSuitabilityResponse" message="tns:ICalculadoraRCP_ListarSuitability_OutputMessage" />
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="BasicHttpBinding_ICalculadoraRCP" type="tns:ICalculadoraRCP">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="Calcular">
          <soap:operation soapAction="http://tempuri.org/ICalculadoraRCP/Calcular" style="document" />
          <wsdl:input>
            <soap:header message="tns:ICalculadoraRCP_Calcular_InputMessage_Headers" part="ServiceHeader" use="literal" />
            <soap:body use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="ListarSuitability">
          <soap:operation soapAction="http://tempuri.org/ICalculadoraRCP/ListarSuitability" style="document" />
          <wsdl:input>
            <soap:header message="tns:ICalculadoraRCP_ListarSuitability_InputMessage_Headers" part="ServiceHeader" use="literal" />
            <soap:body use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="CalculadoraRCP">
        <wsdl:port name="BasicHttpBinding_ICalculadoraRCP" binding="tns:BasicHttpBinding_ICalculadoraRCP">
          <soap:address location="http://localhost:2222/by5/CalculadoraRCP.svc" />
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>

    Gostaria de saber se existe alguma maneira de manter a assinatura compatível, para evitar a atualização dos clientes, que são muitos.

    Obrigado

    quarta-feira, 31 de outubro de 2018 15:27

Todas as Respostas