(C#) Transition from Http.PostXml to Http.HttpStr
Provides instructions for replacing deprecated PostXml method calls with HttpStr. Note: This example requires Chilkat v11.0.0 or greater.
Chilkat.Http http = new Chilkat.Http();
string url = "https://example.com/something";
string requestBodyXml = "<something>...</something>";
string charset = "utf-8";
// ------------------------------------------------------------------------
// The PostXml method is deprecated:
Chilkat.HttpResponse responseObj = http.PostXml(url,requestBodyXml,charset);
if (http.LastMethodSuccess == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using HttpStr.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
Chilkat.HttpResponse responseOut = new Chilkat.HttpResponse();
bool success = http.HttpStr("POST",url,requestBodyXml,charset,"application/xml",responseOut);
if (success == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
|