Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Outstanding Contributor.. lb1 Outstanding Contributor..
Outstanding Contributor..
299 views

Web HTTP/HTML: how to record a RESTrequest with Basic authentication

Jump to solution

Hi all, 

I have to make a script for a single REST web service, with all parameters in the endpoint and a Basic authentication in which you have to specify the domain. I've try to open a Web HTTP-HTML new script, and click on "Design -> Insert in Script -> REST API" option, so I've insert the URL in the form and the fuction web_rest will made; after I've insert the web_set_user() function and I've also specify the credential on Runtime Settings (under "Internet Protocol -> Proxy -> Authentication" but when I run the script the error below appeared: 

HTTP Status-Code=401 (Unauthorized) for "https://...."

Can anyone explain me what's the procedure to record a REST web service? Thank you very much. 

Below an extract from the script in Web HTTP-HTML protocol: 

web_rest("web_service_1",
        "URL=http://sgssw0.syssede.systest.sanpaoloimi.com:24064/mxomniaweb/mxrest/MXOMNINSTANCE?SERVICE_ID=&LISTEN_HOST=saxstp526",
        "Method=GET",
        "EncType=raw",
        "Snapshot=t296930.inf",
        LAST);

0 Likes
1 Solution

Accepted Solutions
Outstanding Contributor.. lb1 Outstanding Contributor..
Outstanding Contributor..

Re: Web HTTP/HTML: how to record a RESTrequest with Basic authentication

Jump to solution

Hi all, 

I've found a possible solution to my doubt: the problem was about the Basic authentication in Web HTTP-HTML recording for web services. Since the upload of URL or responses from "Design -> Insert in Script -> REST API" option doesn't work, I've load the endpoint and the message in a SoapUI project, so I've add an authentication (in Basic mode, you can choose many options of web authentication) and run a request: I've copied the request authentication header and put it in a web_add_header() function. 

    web_add_header("Authorization", "Basic GETDRDNBEY==");

Naturally this step will be set before the web_custom_request() or web_url() functions, so to add an authentication header to all request messages. Now the script goes well. 

Thanks for the collaboration, 

Lorenzo

0 Likes
3 Replies
Highlighted
JorgeDuran-PCLR Respected Contributor.
Respected Contributor.

Re: Web HTTP/HTML: how to record a RESTrequest with Basic authentication

Jump to solution

Hi, 

Thanks for the information. 

Could you please specify the version that you are using? 

In the link below you will find useful information about how to create a script for a REST API (version 12.56-57)

https://admhelp.microfocus.com/lr/en/12.56-12.57/help/WebHelp/Content/VuGen/t_RESTAPI.htm

Regards,

 

 

Outstanding Contributor.. lb1 Outstanding Contributor..
Outstanding Contributor..

Re: Web HTTP/HTML: how to record a RESTrequest with Basic authentication

Jump to solution

Hi Jorge, 

thanks for suggestions. I've just read that article in the official documentation, but the methods explained can't find any solution on the problem, maybe caused by the application/service itself. I resolve the matter with a simple web_custom_request() function on Web HTTP-HTML protocol, but my intention was that to write something closely related to the problem. I will make some other researches on the web and I'll write if I found something useful. 

Thanks again,

Lorenzo

0 Likes
Outstanding Contributor.. lb1 Outstanding Contributor..
Outstanding Contributor..

Re: Web HTTP/HTML: how to record a RESTrequest with Basic authentication

Jump to solution

Hi all, 

I've found a possible solution to my doubt: the problem was about the Basic authentication in Web HTTP-HTML recording for web services. Since the upload of URL or responses from "Design -> Insert in Script -> REST API" option doesn't work, I've load the endpoint and the message in a SoapUI project, so I've add an authentication (in Basic mode, you can choose many options of web authentication) and run a request: I've copied the request authentication header and put it in a web_add_header() function. 

    web_add_header("Authorization", "Basic GETDRDNBEY==");

Naturally this step will be set before the web_custom_request() or web_url() functions, so to add an authentication header to all request messages. Now the script goes well. 

Thanks for the collaboration, 

Lorenzo

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.