Autenticación Web Services

Alguien me puede echar una mano con este inconveniente, agrego aqui al equipo @abapers

Se produjo una excepción de tipo ‘System.ServiceModel.ProtocolException’ en mscorlib.dll pero no se controló en el código del usuario

Información adicional: el tipo de contenido text/xml del mensaje de respuesta no coincide con el tipo de contenido del enlace (application/soap+xml;charset=utf-8). Si usa un codificador personalizado, asegúrese de que el método IsContentTypeSupported se implemente correctamente. Los primeros 1024 bytes de la respuesta fueron: '<?xml version="1.0" encoding="utf-8"?><wsdl:definitions targetNamespace="urn:sap-com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:rfc:functions" 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"><wsdl:documentation><sidl:sidl xmlns:sidl="http://www.sap.com/2007/03/sidl"/></wsdl:documentation><wsp:UsingPolicy wsdl:required="true"/><wsp:Policy wsu:Id="IF_IF_zws_out_clientes"><sapsession:Session xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/"><sapsession:enableSession>false</sapsession:enableSession></sapsession:Session></wsp:Policy><wsp:Policy wsu:Id="OP_IF_OP_ZFI_BANDE_OUT_C'.

Web.config:

 <wsHttpBinding>
        <binding name="OPCION1">
          <security mode="Transport">
            <transport clientCredentialType="Basic" proxyCredentialType="Basic" />
            <message clientCredentialType="UserName" negotiateServiceCredential="true"
                           algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
 
 
      </wsHttpBinding>
 
    </bindings>
    <client>
      <endpoint address="https://usmiavs026.bremat.local:8180/sap/bc/srt/wsdl/flv_10002P111AD1/sdef_url/ZWS_OUT_FACTURAS?sap-client=100" binding="wsHttpBinding" bindingConfiguration="OPCION1" contract="SAP_FAC.zws_out_facturas" name="ZWS_out_facturas"/>
      <endpoint address="https://usmiavs026.bremat.local:8180/sap/bc/srt/wsdl/flv_10002P111AD1/sdef_url/ZWS_OUT_CLIENTES?sap-client=100" binding="wsHttpBinding" bindingConfiguration="OPCION1" contract="SAP_CLI.zws_out_clientes" name="ZWS_out_clientes"/>
      <endpoint address="https://usmiavs026.bremat.local:8180/sap/bc/srt/wsdl/flv_10002P111AD1/sdef_url/ZFI_WS_ACT_TASA_CAMBIO?sap-client=200" binding="wsHttpBinding" bindingConfiguration="OPCION1" contract="SAP_TAS.ZFI_WS_ACT_TASA_CAMBIO" name="ZFI_WS_ACT_TASA_CAMBIO"/>
    </client>
  </system.serviceModel>

Code Behind:

SAP_CLI.zws_out_clientesClient ws = new SAP_CLI.zws_out_clientesClient("ZWS_out_clientes");
 
        ws.ClientCredentials.UserName.UserName = "webservices";
        ws.ClientCredentials.UserName.Password = "webservices";
 
        SAP_CLI.ZFI_BANDE_OUT_CLIENTE datos = new SAP_CLI.ZFI_BANDE_OUT_CLIENTE();
        datos.I_FECFIN = DateTime.Now.ToShortDateString();
        datos.I_FECINI = DateTime.Now.AddDays(-1000).ToShortDateString();
        SAP_CLI.ZFI_BANDE_OUT_CLIENTEResponse Result = new SAP_CLI.ZFI_BANDE_OUT_CLIENTEResponse();
 
        Result = ws.ZFI_BANDE_OUT_CLIENTE(datos);

Estimado, revisaste el log de ejecución en Soamanager? Con ese código es más fácil encontrar la solución.

Hola @Shadowdancer, podrias comentarme si el web service lo estan tratando de consumir desde .NET (C#), de ser asi, faltaria especificar o crear un encoder que coincida con tipo de contenido del web service que estan consumiendo.

El problema es que estan consumiendo el web service con un tipo text/xml cuando el servicio marca un tipo de contenido application/soap+xml (ambos en utf-8), esto lo define el binding (basicHttpBinding SOAP 1.1, wsHttpBinding SOAP 1.2) y el que estan usando es correcto. Algo dentro de su Binding (<wsHttpBinding><binding> !!! <binding><wsHttpBinding>) es lo que les esta causando el problema intenta comentando todo el nodo de binding (Solo como prueba, despues, si funciona tendras que ver cual o cuales parametros son los incorrectos).

Saludos!!

Este tema se cerró automáticamente 91 días después del último post. No se permiten nuevas respuestas.