C sharp - Ayuda con conexión a servicio de SUNAT

 
Vista:
sin imagen de perfil

Ayuda con conexión a servicio de SUNAT

Publicado por Geancarlo (1 intervención) el 04/05/2015 16:41:04
Hola, estoy intentando conectarme a un servicio web de SUNAT para facturación electrónica (https://www.sunat.gob.pe:443/ol-ti-itcpgem-beta/billService?wsdl), la cual usa autenticación por WS-Security. Sin embargo estoy recibiendo el siguiente mensaje de error:

Se detectó System.ServiceModel.ProtocolException
HResult=-2146233087
Message=El tipo de contenido text/plain del mensaje de respuesta no coincide con el tipo de contenido del enlace (text/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: 'HTTP/1.1 100 Continue

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:sendBillResponse xmlns:ns2="http://service.sunat.gob.pe"><applicationResponse>UEsDBBQACAAIAMhKpEYAAAAAAAAAAAAAAAAiAAAAUi0yMDYwMDA2NDk0MS0wMS1GMDAxLTAwMDAwMDAzLnhtbK1YWXeqyBZ+bn+F137MypHBAV1JehWToIKCoGKvfkAoEWVQQAZ/+n26hUZjjOl7+qw2MVp7qm9/tavYlZc/ct+rpjCK3TB4reE/sFoVBlZou4HzWhMno2eKanae8Vo1TszANr0wgK+1IKz98fYCdjvPtcwEeaow3oVBDKsoWhC/1g5R0A3N2I27genDuBvvoOWu3o27h6XXja019M1uHtvdB3Geido5VNcyrX8Yjgl9PwyA40TQMROIhigkDJL4Jujy14LSyNx6FNBGOa+TZNet17Ms+5GRP8LIqRMYhtWxTh3Z2LHr/H6xhnnyS9NzeQKDcqE+QXirVKro9YKidnV6eDWK3yq//fZFWgrP0ptoAfqWvL3YcXfiOoGZHCJYFe3XWjma6DLQalcltMVgFZ6GjBmEAQLsuccTaAkm69CuAs8JIzdZ+48o0dSSFbyucswzIuPZwhvBcynBSLxZq3/G8DMB7zmOYvM5Xpv4eywVrmCEChpWdVV8rZ3z0CIziFdh5Mefh/9sJhik0At30H6OL4DLSetfJ2BdB8bJr2Rzk8k5yNT0DvDNI7jhGFCmNdut26O4IMjDrjfPlM1Cej0BuDU+Ca48nId3K3ll/OwRDDuM1zZasw1PNUaF2JFNIcEIdrAogj25m9n8bEkSpjmLrFgF2GGvZ/VhaLArB1f8rVvQfuwwlkBOi7ZUsfaLcXuU9tsYSRyKqD/lO8'.
Source=mscorlib
StackTrace:
Server stack trace:
en System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
en System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
en System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
en System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
en System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
en System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
en System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
en System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
en System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
en System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
en wsunat.sunat.billService.sendBill(sendBillRequest request)
en wsunat.sunat.billServiceClient.wsunat.sunat.billService.sendBill(sendBillRequest request) en c:\Users\GC\Documents\Visual Studio 2013\Projects\wsunat\wsunat\Service References\sunat\Reference.cs:línea 289
en wsunat.sunat.billServiceClient.sendBill(String fileName, Byte[] contentFile) en c:\Users\GC\Documents\Visual Studio 2013\Projects\wsunat\wsunat\Service References\sunat\Reference.cs:línea 296
en wsunat.Class1.hola() en c:\Users\GC\Documents\Visual Studio 2013\Projects\wsunat\wsunat\Class1.cs:línea 25
InnerException: System.Net.WebException
HResult=-2146233079
Message=Error en el servidor remoto: (500) Error interno del servidor.
Source=System
StackTrace:
en System.Net.HttpWebRequest.GetResponse()
en System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
InnerException:


Espero puedan ayudarme.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Ayuda con conexión a servicio de SUNAT

Publicado por jonathan (1 intervención) el 08/03/2016 15:32:02
Llegaste a solucionar este error?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Ayuda con conexión a servicio de SUNAT

Publicado por Alberto (1 intervención) el 12/06/2016 23:41:42
Pueden descargar una DLL para hacer las transmisiones de facturación electrónica desde aquí:

http://www.inventia.pe/Descargas
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar