Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagec#
// 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());

...

Code Block
languagec#
using System.Xml;

// Prepare instance of SOAP client class (class is generated automatically based on WSDL)
Creditcheck_ServiceReference.CreditCheckAktualizaceSoapClient client =
    new Creditcheck_ServiceReference.CreditCheckAktualizaceSoapClient(Creditcheck_ServiceReference.CreditCheckAktualizaceSoapClient.EndpointConfiguration.CreditCheckAktualizaceSoap);

// Prepare instance of CreditCheckHeader
Creditcheck_ServiceReference.CreditCheckHeader ccHeader = new Creditcheck_ServiceReference.CreditCheckHeader();
ccHeader.Login = "{login}";
ccHeader.Password = "{password}";

// Call WS method GetCreditCheck
var getCreditChecksResult = await client.GetCreditChecksAsync(ccHeader);


// Define request parameters
string gsfrXmlRequest = @"
                <requestSubject>
                    <subjectType>Company</subjectType>
                    <ic>{ico}</ic>
                </requestSubject>";

XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(gsfrXmlRequest);

var// getCreditChecksResultCall =WS await client.GetCreditChecksAsync(ccHeader);method GetSubjectFullReport
var getSubjectFullReportResult = await client.GetSubjectFullReportAsync(ccHeader, xmlDocument);

...