Consume API from BC use HTTP Client getting error, from Postman working fine

I have weird issue regarding BC consume XML API using HTTP Client.

if i send a request from BC to API, i will get an error like below

Image

but if send a request using postman, working fine

Image

then i have tried to restart the server then the problem solved.

here is the request headers, my code in BC, sample request and the response from API

Image

Response.xml
AL Code send Req XML API
body request sample

Kindly need help how to fix the problem without restarting the server.

1 Like

content.GetHeaders(lheaders);
lheaders.Clear();
lheaders.Remove(‘Content-Type’);
lheaders.Add(‘Content-Type’, ‘text/xml; charset=UTF-8’);
content.GetHeaders(lheaders); <----- this is replacing what you just did ^

(here is a snippet from my API call to salesforce)
content.GetHeaders(contentHeaders);
ContentHeaders.Remove(‘Content-Type’);
ContentHeaders.Add(‘Content-Type’, ‘application/x-www-form-urlencoded’);

request.Content := content;
request.SetRequestUri(uri);
request.Method := ‘POST’;

if client.Send(request, response) then begin ------------

1 Like