HttpClientRequest as proxy

Avatar

Avatar
Validate 1
Level 1
marting66652718
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
marting66652718
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
marting66652718
Level 1

18-01-2018

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!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

370 likes

Total Posts

726 posts

Correct reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

370 likes

Total Posts

726 posts

Correct reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

24-01-2018

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

Answers (4)

Answers (4)

Avatar

Avatar
Validate 1
Level 1
marting66652718
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
marting66652718
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
marting66652718
Level 1

02-02-2018

Things*

Avatar

Avatar
Validate 1
Level 1
marting66652718
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
marting66652718
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
marting66652718
Level 1

02-02-2018

Hi,

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

Martin

Avatar

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile
florentlb
Level 10

02-02-2018

Hi Martin,

How did that go with Vipul's suggestion?

Florent

Avatar

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile

Avatar
Give Back 50
Level 10
florentlb
Level 10

Likes

237 likes

Total Posts

1,109 posts

Correct reply

239 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 200
View profile
florentlb
Level 10

22-01-2018

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