To call HTML Page URL from Rest API

Posted by shilpi.agarwal3373 on 23-Nov-2016 08:02

Hi,

I need to call a HTML page(URL) from Rest Web Service. What are the steps to accomplish this.

Can you please suggest me step by step procedure?

Thanks.

Shilpi Agarwal

All Replies

Posted by Peter Judge on 23-Nov-2016 08:08

Do you mean from an ABL REST service , call another , external (different host) REST service? If so you can start at documentation.progress.com/.../making-http(s)-requests-from-abl-applications.html

Posted by shilpi.agarwal3373 on 23-Nov-2016 08:28

No, its not.

We need to call a webspeed application (URL) from Rest Service.

Posted by Matt Baker on 23-Nov-2016 08:39

You need to explain this better.

Are you trying to call webspeed from the user interface, or are you trying to call the webspeed program from the backend of your REST service.

Is WebSpeed returning JSON or is it returning an HTML page?

If it is an HTML page, how are you intending to consume it?  Are you thinking to open a web browser to show the page?

If the webspeed program is returning JSON...then use the built-in HTTP client to consume it from the backend of your REST service.

Posted by shilpi.agarwal3373 on 23-Nov-2016 08:52

Are you trying to call webspeed from the user interface, or are you trying to call the webspeed program from the backend of your REST service

Ans:- Need to call the webspeed program from the backend of REST service

Is WebSpeed returning JSON or is it returning an HTML page?

Ans- WebSpeed should return HTML Page

If it is an HTML page, how are you intending to consume it?  Are you thinking to open a web browser to show the page? -

Ans:- I need to open a web browser to show the page

Requirement is:- i have created a Rest web service which authenticate s the user , once it is completed successfully, i need to redirect to a login page of web speed application. So I am looking for How to redirect to application's login page from Rest Web Service.

Posted by Brian K. Maher on 23-Nov-2016 08:58

Shilpi,
 
Is the REST service running on the same physical machine /AND/ user session (logged in user)?
 
If not, how do you expect to have the REST service to cause the users machine (and session) to display a browser?
 
Brian

Posted by shilpi.agarwal3373 on 23-Nov-2016 09:14

The example given by me was not sufficient enough. Please ignore it.

Need to call the webspeed program from the backend of REST service. This webspeed program is html page and want to show in browser. Question is- Can we call A webspeed program which is a html page from our rest api? If yes So Do i need to write some socket programming for it.

Posted by Brian K. Maher on 23-Nov-2016 09:22

Shilpi,
 

>> Can we call A webspeed program which is a html page from our rest api? If yes So Do i need to write some socket programming for it.

This was already answered by Matt Baker.  You can do this using the HTTP classes we provide (assuming you are on a current release).
 
How about providing us with more detail rather than less?  First, tell us the version of OpenEdge you are using.  Second, tell us how you expect a browser opened by a REST service (presumably running on a different machine) is going going to open a web browser (which I assume you will want to display to the user).  There is much detail that you are leaving out and that detail is critically important information that we need to provide you with a good resolution.
 
Brian

Posted by Matt Baker on 23-Nov-2016 09:22

If you are on a recent version (11.5.1+) you can use the built-in HTTP client as Peter pointed out to make HTTP requests. But this isn't opening a web page in a browser.

If your server running your REST service isn't on the user's same machine (and even if it is is not a guarantee) you cannot open a web browser.  Your client application is going to have to get the credentials BEFORE going to the rest service.

Once you have those credentials you can pass them down to your REST service in same fashion and perform the HTTP request.  Get whatever token back from WebSpeed and then pass it back from the REST service back to your client application.

Calling from an ABL REST service to a separate HTTP service isn't hard.  Peter's response above has a link above on how to do this. But you're not going to open a web browser on the user's desktop machine if you're running ABL code on  a separate server machine.

Posted by shilpi.agarwal3373 on 23-Nov-2016 09:47

using OE 11.4 version. and Rest Web Service and the webspeed application which i want to call from my  rest API are on the same server.

Posted by Irfan on 23-Nov-2016 14:19

REST Services created by REST Adapter can only return you back JSON. It cannot return XML or HTML. If you are using OE version prior to 11.6 then you need to make a HTTP Request to the Webspeed code to return the HTML Page. I do not understand why you would like to have a REST Adapter to do this(other than security).

If you move to 11.6 and above, you can accomplish the same things that you do with REST Adapter using PASOE WebHandlers and return HTML/JSON/XML output.

Posted by shilpi.agarwal3373 on 24-Nov-2016 00:34

Hi All,

Now Let me explain the whole thing which I need help from you.

I am implementing SSO in SAML and using IDP initiated flow in SAML. For this, I have created a Rest server at SP side and taking any IDP like One Login or OKta to register SP.

1. First User signs on IDP and  then the user selects a  link on the IdP to request access to an SP web site.(HTTP Request is made)

2. IDP  sends an assertion (that is SAMLResponse in form of xml) to Service provider(SP).  

3. SP Receives the assertion, decode it. and then SP needs to redirect HTTP response to the browser to show the desired HTML page (webspeed application).

I need to know, how to redirect request from REST service to a webspeed application. REST service and webspeed application are on the same server.

Please suggest.

This thread is closed