848
Views
3
Comments
Consume REST services through a http proxy
Question
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
2017-01-13 11-36-43
Pedro Saraiva
Staff
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
 
 
Extended_REST.xif
2021-08-15 08-10-08
GBCS

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

2024-10-31 11-20-01
Luís Rondão
 
MVP

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!



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.