We are under construction!

You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.

Forum Discussion

Oscar's avatar
Oscar
Contributor
7 months ago

HttpClient Sample Code

I am trying to revamp the data integration between OneStream and Oracle Financial Cloud. The implementation partner used HttpWebRequest throughout the integration business rules but under platform 8.2 this functionality is now obsolete. Is there a working sample from OneStream on how to employ HttpClient with Oracle? 

  • I do something like this:

    string url = "http://www.example.com";
    
    using (HttpClient client = new HttpClient())
    {
        HttpResponseMessage response = await client.GetAsync(url);
        response.EnsureSuccessStatusCode();
        
        string content = await response.Content.ReadAsStringAsync();
        BRApi.ErrorLog.LogMessage(content);
    }

    VB:

    Dim url As String = "http://www.example.com"
    
    Using client As New HttpClient()
        Dim response As HttpResponseMessage = Await client.GetAsync(url)
        response.EnsureSuccessStatusCode()
    
        Dim content As String = Await response.Content.ReadAsStringAsync()
        BRApi.ErrorLog.LogMessage(content)
    End Using
    
    

     

  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    I do something like this:

    string url = "http://www.example.com";
    
    using (HttpClient client = new HttpClient())
    {
        HttpResponseMessage response = await client.GetAsync(url);
        response.EnsureSuccessStatusCode();
        
        string content = await response.Content.ReadAsStringAsync();
        BRApi.ErrorLog.LogMessage(content);
    }

    VB:

    Dim url As String = "http://www.example.com"
    
    Using client As New HttpClient()
        Dim response As HttpResponseMessage = Await client.GetAsync(url)
        response.EnsureSuccessStatusCode()
    
        Dim content As String = Await response.Content.ReadAsStringAsync()
        BRApi.ErrorLog.LogMessage(content)
    End Using