cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_HTTP_CLIENT returns javascript code

0 Likes
791

Hi,

My ABAP program is using CL_HTTP_CLIENT to read currency rates off a banks HTTP webpage. It's a simple read on a public facing website that returns data in XML format, no logging in or anything is required. Sometimes the data is read correctly but seemingly randomly, this javascript code below is returned instead:

 <HTML><HEAD><META HTTP-EQUIV="Refresh" CONTENT="0"><SCRIPT Language="JavaScript">var coupon1= 23432;var coupon2= 23432;var style1= 21154;var style2= 123432;var add =coupon1+coupon2+style1+style2;document.cookie="MTD_EPTQ="+add+";path=/";window.location=window.location.href;window.focus();</SCRIPT></HEAD></HTML>

What is also strange is I have the same program scheduled to run at the same time on another system, and that would read the webpage OK. The currencies are updated hours before the ABAP program is run so I know they aren't being updated by the bank at that time. My expertise is ABAP not this web stuff so I am confused as to what could be happening. Any help would be appreciated, thanks!

Thks,
sapmanie

Accepted Solutions (0)

Answers (3)

Answers (3)

SimoneMilesi
Active Contributor
0 Likes

Hello Sap Manie,

first of all, you are receiving an HTML page, not Javascript: you can see it from the initial tag <HTML>

This means that you are receiving the web page source as answer: the same thing you can see if (on CHROME) you press F12

Check the webservice you are calling (the URL) if it accepts/need a parameter to specify the output (JSON, HTML, XML...)

enric101
Active Contributor
0 Likes

Hi,

Is it possible to add the URL here?

Maybe this website has a JS protection system or it is created with a JS framework.

Regards

Ankit_Maskara
Product and Topic Expert
Product and Topic Expert
0 Likes

If you know of a pattern by which this random output can be reliably reproduced, then debugging till external call is made and response is retrieved is one possible hint.