mercredi 9 décembre 2020

Sending XML Web Request

We are currently working on a connection to a Web API via XML requests. Our XML statement is as far as correct and also the URL is correct. Nevertheless we receive the following error from the server:

The remote server has returned an error: (403) Inadmissible.

Is there at least one way to get a more detailed error message? By the way, the API is not from us so we don't have access to the logs of the backend.

XML Request:

<?xml version="1.0" encoding="utf-8"?>
 <OTA_PingRQ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="3.3" TimeStamp="2020-12-09T13:53:57" PrimaryLangID="en" Target="Production">
  <EchoData><![CDATA[Hello World]]></EchoData>
</OTA_PingRQ>

Web Call:

using (var wb = new WebClient())
            {
                var data = new NameValueCollection();
                data["otaRQ"] = xml;

                var response =
                wb.UploadValues("http://backend.cultuzz.com:7380/cultswitch/processOTA",
            "POST", data);
                string responseInString = Encoding.UTF8.GetString(response);
                MessageBox.Show(responseInString);
            }



Aucun commentaire:

Enregistrer un commentaire