Highlighted
Contributor.
Contributor.
262 views

TRUCLIENT WEB - HTTP SEND in EVAl JS not working

Hello All,

This is regarding the TruClient Web protocol. The issue, I am facing is - I am unable to make a http.send() (in eval JS)to 1 particular url in between my transaction.

The same code works in different part of the same script. But for some reason, I am unable to find what is causing the issue.

Transaction in which code works

1111.png

The Code inside the Eval JS is below

const http= new XMLHttpRequest();
const url='http://<servername>:8086/write?db=rpt';  // this call works in above HomePage transaction but not in OPEN_Teams
http.open("POST",url,true);
http.setRequestHeader("Content-type", "application/json");

var duration=TC.transactionDuration("HomePage");
var data_to_send="healthCheckTestV1";

data_to_send=data_to_send.concat(",","transactionName=HomePage,transactionStatus=PASS responseTime=");
data_to_send=data_to_send.concat("",duration);
data_to_send=data_to_send.concat(",","successCount=1,errCount=0");

TC.log("The data i am sending issss"+data_to_send, "Standard");
http.send(data_to_send);

http.onreadystatechange=(e)=>{
console.log(http.responseText)
}

Transaction in which code DOES NOT works

2222.png

 

I tried to debug the script, by running it when the fiddler is ON, but I dont find the call is made to that server. but the strange thing is - if i change it to some other url like google or yahoo, the call is made.

Basically this code, logs the response time of the transactions into the influx DB.

There is no change in the above code, except the Transaction Name. But for some reason, I am unable to call that particular server name.

Not sure, what i am missing. I thought if the script was corrupted and did the fresh recording and updated the changes, but found the same behaviour.

0 Likes
2 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: TRUCLIENT WEB - HTTP SEND in EVAl JS not working

Did you try to instrument your javascript code with alert() calls to see intermediate results?

You write 'the same' code, the obvious question is then, did you change the transactions name (sorry for asking this).

Signature:
Reward community members who take time to respond and help.
0 Likes
Highlighted
Contributor.
Contributor.

Re: TRUCLIENT WEB - HTTP SEND in EVAl JS not working

Yes the transaction name is changed. 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.