Consume REST services through a http proxy

Consume REST services through a http proxy

  
Hi,

I know that it's possible to invoke SOAP services through a http proxy using the extension EnhancedWebReferences.

Is there something similar for the REST services?
 
Thanks
Hello Luís,

For calling a REST through a proxy you need to select the On Before Request (Advanced) and use an extension to set the proxy for that request.

Attached find an example for an extension where you can set the proxy on the OnBeforeRequest(Advanced) action.



Luís Rondão wrote:
Hi,

I know that it's possible to invoke SOAP services through a http proxy using the extension EnhancedWebReferences.

Is there something similar for the REST services?
 
Thanks
 
 

Hi,  I have tried the extension but getting an authentication failed error message. Can you please advice? Thanks!

The extension Pedro shared doesn't receive credentials, so it may not work for you.

You can edit the SetProxy method in Integrations Studio / Visual Studio to receive the credentials as an input and set them in the proxy.

Change the code in Visual Studio to be something like this:

public void MssSetProxy(string ssProxyURL, string ssProxyUsername, string ssProxyDomain, string ssProxyPassword) {
            var httpWebRequest = OutSystems.RuntimePublic.REST.RestRequest.GetCurrent().GetHttpWebRequest();
            WebProxy proxyObject = new WebProxy(ssProxyURL);

            proxyObject.UseDefaultCredentials = false;
            proxyObject.Credentials = new NetworkCredential(ssProxyUsername, ssProxyPassword, ssProxyDomain);
            proxyObject.BypassProxyOnLocal = false;

            httpWebRequest.Proxy = proxyObject;

Luís

No War wrote:

Hi,  I have tried the extension but getting an authentication failed error message. Can you please advice? Thanks!