Error during deserialization of the body of the response message for the operation - WSDL

3

I'm new to implementing services as a reference, and I see myself at the moment in a dead end.

I successfully test the call to service via Postman. It is worth saying that a certificate is required, but once added to Postman, I have no problem.

I'm trying to consume this same service referenced in my application in Web_AppReferences. The .wsdl file used to add the reference to the project comes from a url provided by the company that developed it. Thus, as expected, some classes (types) are generated and made available as metadata. Among them we have the class (type) that allows me to instantiate the client that will consume the service and the class (type) that will be used to receive the response.

The client object used to make the service call needs to be configured in my application to meet service requirements:

var transport = new HttpsTransportBindingElement();
transport.RequireClientCertificate = true;  
CustomBinding binding = new CustomBinding(new CustomTextMessageBindingElement("ISO-8859-1", "text/xml", MessageVersion.Soap11), transport);       
cliente.Endpoint.Binding = binding;
cliente.ClientCredentials.ClientCertificate.Certificate = SecureWebServiceHelper.CriarCertificado();

Next, the client calls the service by passing the expected parameter:

respostasolicitarProtocoloWS resposta = cliente.solicitarProtocoloOperation(solicitacao);

However, when it gets its response, an exception is generated:

"Exeption: An error occurred during the deserialization of the response message body for the 'requestProtocolOperation' operation. InnerException: Error in XML document (1, 548). InnerException: Invalid character in supplied encoding. Line 1, heading 548. "

By consulting the company that makes the service available to me, I get information that my calls are successful within their application. This leads me to think that the problem may be generated by some misconfiguration in my application or even in Visual Studio. Anyone have any ideas?

    
asked by anonymous 10.11.2017 / 19:10

1 answer

0

Hello.

Try changing the following settings in the client app.config:

<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    
03.01.2018 / 20:19