my c# code to call webservice -
var content = new StringContent(req.Body.ToString(), Encoding.UTF8, "application/xml"); ;
HttpClient httpClient = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://mydemo.com/service.asmx?pk=listCustomer");
var byteArray = Encoding.ASCII.GetBytes("username:password");
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
request.Content = content;
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
HttpResponseMessage response = await httpClient.SendAsync(request);
// getting 500 error in response data at root level invalid
in postman i call this azure function to pass xml input.
xml input format is -
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<listCustomer xmlns="http://tempuri.org/">
<id>KH001</id>
<fromDate>01/01/2018</fromDate>
<toDate>01/01/2020</toDate>
</listCustomer>
</soap:Body>
</soap:Envelope>