// Prepare HttpClient
var client = new HttpClient();
// Define a new HTTP POST Request
var request = new HttpRequestMessage(HttpMethod.Post, "https://creditwebservices.creditcheck.cz/CreditCheckAktualizace.asmx");
// Add SOAPAction header to the Request
request.Headers.Add("SOAPAction", "https://creditwebservices.creditcheck.cz/GetSubjectFullReport");
// Add content to the Request
var content = new StringContent("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soap:Header>\n <CreditCheckHeader xmlns=\"https://creditwebservices.creditcheck.cz/\">\n <Login>{login}</Login>\n <Password>{password}</Password>\n </CreditCheckHeader>\n </soap:Header>\n <soap:Body>\n <GetSubjectFullReport xmlns=\"https://creditwebservices.creditcheck.cz/\">\n <subjectData xmlns=\"https://creditwebservices.creditcheck.cz/\">\n <requestSubject>\n <subjectType>Company</subjectType>\n <ic>00014915</ic>\n </requestSubject>\n </subjectData>\n </GetSubjectFullReport>\n </soap:Body>\n</soap:Envelope>", null, "text/xml; charset=utf-8");
request.Content = content;
// Call Web service
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync()); |