on ‎2018 Jun 12 10:55 PM
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
Request clarification before answering.
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...)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.