Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

HttpClientRequest as proxy

Avatar

Level 3

Hey, I just built a get function that calls on a https API, but the server-department at my office wants me to use a proxy for this. Im relativily new to proxies, so my question is if anyone has an idea of how to wrap this get function in to a https proxy?

loadLibrary("cus:json3.js");

//Require temp Schema to match against city

var query = xtk.queryDef.create(

  <queryDef operation="select" schema={vars.targetSchema}>

    <select>

      <node expr="@smartcity"/>

    </select>

  </queryDef>

);

var res = query.ExecuteQuery();

function getCall(){

  var http = new HttpClientRequest();

  http.url = "https://url..." + line.@smartcity + "...restoftheurlandkey";

  http.method = "GET"; //The GET request

  http.execute();

  var response = http.response;

  logInfo( response.body.toString());

};

for each (var line in res) {

  getCall();

};

In regards, Martin!

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Martin,

There is a setting in serverConf.xml and it is called as <proxyConfig> where you can define subnodes as <proxyHTTP> and <proxyHTTPS> wherein you can define the proxy address, credentials and the port details.

<proxyConfig enabled="true" override="localhost*" useSingleProxy="false">

     <!-- HTTP Proxy -->

     <proxyHTTP address="svr001.zone2.proxy.mynetwork" login="" password="" port="8080" />

     <!-- Secure proxy -->

     <proxyHTTPS address="svr001.zone2.proxy.mynetwork" login="" password="" port="8080" />

</proxyConfig>

However, as per my knowledge, there is a limitation at Campaign side that proxy is not used by activities like Web Download. Not sure if the impact is on JS code activity as well.

I'll suggest to get the proxy settings applied in the config, then restart the services.

Post that test your code. Another way is you can use the curl library to make a GET request from inside workflow. Test and see if it works.

Regards,
Vipul

View solution in original post

5 Replies

Avatar

Level 10

Hi Martin,

This is far beyond my knowledge, so bumping this thread anyway.

Let me know if you manage to find something in the meantime.

Florent

Avatar

Correct answer by
Employee Advisor

Hi Martin,

There is a setting in serverConf.xml and it is called as <proxyConfig> where you can define subnodes as <proxyHTTP> and <proxyHTTPS> wherein you can define the proxy address, credentials and the port details.

<proxyConfig enabled="true" override="localhost*" useSingleProxy="false">

     <!-- HTTP Proxy -->

     <proxyHTTP address="svr001.zone2.proxy.mynetwork" login="" password="" port="8080" />

     <!-- Secure proxy -->

     <proxyHTTPS address="svr001.zone2.proxy.mynetwork" login="" password="" port="8080" />

</proxyConfig>

However, as per my knowledge, there is a limitation at Campaign side that proxy is not used by activities like Web Download. Not sure if the impact is on JS code activity as well.

I'll suggest to get the proxy settings applied in the config, then restart the services.

Post that test your code. Another way is you can use the curl library to make a GET request from inside workflow. Test and see if it works.

Regards,
Vipul

Avatar

Level 10

Hi Martin,

How did that go with Vipul's suggestion?

Florent

Avatar

Level 3

Hi,

I´ve been buys with other think and will try this out next week. Ill come back to you with an answer.

Martin