Question Difference between HTTP and HTTPS-Request ?

Hi everybody

OE117.2, Win 8.1

I had a perfectly working code, as long as I could access a 3rd-party-website by "HTTP". Now they changed the websites address to HTTPS and I'm lost.

When I enter the following string directly in the address-line of my browser:

https://datapadmo.it-park.at/api/ta...=connect/_immoware&p=28immoware05!&anr=123456

i get the expected answer "{status":"offen"}, which should be a JSON-Response

When I try the same with the following small program:

USING OpenEdge.Net.HTTP.RequestBuilder.
USING OpenEdge.Net.HTTP.ClientBuilder.
USING OpenEdge.Net.HTTP.IHttpRequest.
USING OpenEdge.Net.HTTP.IHttpResponse.

DEFINE VARIABLE oRequest AS OpenEdge.Net.HTTP.IHttpRequest NO-UNDO.
DEFINE VARIABLE oResponse AS OpenEdge.Net.HTTP.IHttpResponse NO-UNDO.

oRequest = RequestBuilder:Get("https://datapadmo.it-park.at/api/ta...=connect/_immoware&p=28immoware05!&anr=123456"):AcceptJson():Request.
oResponse = ClientBuilder:Build():Client:Execute(oRequest).

MESSAGE oResponse:ContentType
VIEW-AS ALERT-BOX INFO BUTTONS OK TITLE PROGRAM-NAME(1).


...I get an HTML-file, which has nothing in common with the JSON-Response i get online.

What I found out - and what I don't understand: Whatever HTTPS-String I use in the request, it changes nothing in the response.
I tried alle the following strings (just to get any different response):
RequestBuilder:Get("https://datapadmo.it-park.at/api/ta...=connect/_immoware&p=28immoware05!&anr=123456"):Request.
RequestBuilder:Get("https://datapadmo.it-park.at/api/task/xp_AppGetTask.xsp"):Request.
RequestBuilder:Get("DataPad"):Request.
RequestBuilder:Get("DataPad"):Request.


It seems that everything after the address-string itself is ignored.

Why? Can somebody pls point out what I'm doing wrong ?

In case somebody would like to try this code, I attatched the CER-File (without this one gets error 9318 - see my previous post "Avoiding SSL-verification). Its the SSL-Verification for "DST Root CA X3"
 

Attachments

  • DST-Root.cer.txt
    1.2 KB · Views: 2

RealHeavyDude

Well-Known Member
So far I've never used the built-in OpenEdge.Net.HTTP client since it doesn't support the SSL client certificate which is required in the environment I work in. I did use the Microsoft .Net HTTP client on Windows and wget or curl on Solaris to do the job. I have several different scenarios where I do use the Microsoft .Net integration to do things which I can't do in the ABL. Of course this is Windows only but this stuff I only need on Windows.

Therefore I can't tell much about the OpenEdge.Net.HTTP client - I hope others can.
 
Right now I'm trying to access the website using sockets (found some nice examples in the Progress KB) and not using the OE-Net-library at all.

Using sockets the call to the website works, i get the expected Json-response, so for me it seems as if this could be a bug in the OE-Net-library.
 

ForEachInvoiceDelete

Active Member
You probably have the wrong content headers. I had issues with Postman/Chrome adding default headers that the HTTP library doesn't.

Think it was Content-Length causing me issues. (Programmatically it would just return HTML instead, where the browser would return the correct JSON)
 
adding ContentType did not help.

I now tried this request in Postman and get the same result: a html-document instead of a json-response. So i will contact the website-administrator.
Will post an answer as soon as i have a solution

Thanks to everybody
 
my last statement about postman was not correct ! Postman does return the correct json-response.

The reason why I first got an html-response even in Postman was that I had a typing-error in the request-string.

Looked also at the code that Postman sends - very simple, no secret headers or something else:

GET /api/task/xp_AppGetTask.xsp?u=connect/_immoware&p=28immoware05!&anr=123456 HTTP/1.1
Host: datapadmo.it-park.at
Cache-Control: no-cache
Postman-Token: 7986c941-90ac-cdb3-59ac-de8610bc3bb2
 

ForEachInvoiceDelete

Active Member
No I'm pretty sure postman assumes content-length based on your body and fills it in even though it's not displayed. If you use a proxy and bounce your request through you can see it. Interceptor might work to view what chrome is sending. Then compare to what http library is sending
 
With the help of progress-support we found the reason why HTML is returned instead of Json!

The problem is the "?" in the URL: https://datapadmo.it-park.at/api/task/xp_AppGetTask.xsp?.........

the Http-library seems to do some URL-encoding and changes it to "%03F", and thats why HTML is returned instead of Json. If I send the URL with the "?" via a socket, everything is fine.

Which explains the error, but doesn't solve the problem. But that's a question for the API-provider.

thanks to everybody who tried to help, Wolf


 
Additional info for those who are interested:

just got another response from progress-support: There was a bug in OE11.7, not completely related to url-encoding, but more about how the URL is parsed and fragmented. And that had a side effect causing the encoding of the '?' character.

This bug was fixed in 11.7.3 (issue PSC00363708).
 
Top