No announcement yet.

Xmlexport with c#

  • Filter
  • Time
  • Show
Clear All
new posts

  • Xmlexport with c#

    sorry but i have no experience with otm and i have to develop a program that extracts data.
    I use the method called "Sql Query" which consists in sending an xml with a "Statement" tag where I pass the select I want to do.
    I should get a response with another xml where the data is.
    The example curl command they gave me works:
    curl -k -u user: password --basic -d @ test.xml -H "Content-Type: application / xml" https: //otmgtm-*********.otm.em2.oraclecloud. com / GC3 / glog.integration.servlet.DBXMLServlet? command = xmlExport
    If I try to make a C # program that queries the database, the GetResponse method gives me this error:
    IOException: Authentication failed. The remote party has closed the transport flow.
    I tried using HttpWebRequest, HttpClient, WebClient but always with the same result.
    I am sending you a code example, quite standard, but, I repeat, I have tried various versions, removing / adding various properties, etc etc ... and all with the same result.
    HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url);
    request.Method = "POST";
    request.Accept = "text/xml";
    request.Credentials = new NetworkCredential (username, password);
    request.ContentType = "text/xml";
    using (var streamWriter = new StreamWriter (request.GetRequestStream ()))
    streamWriter.Write (xml);
    var response = request.GetResponse ();

    Please, Is there someone who can help me?