1. CJ Lai
  2. PowerBuilder
  3. Monday, 4 February 2019 20:57 PM UTC

Hi PB Experts

I have run into an issue that, for the life of me, I cannot solve.

I need to access PDF files on a share drive on a remote server using URL.

If I copy and paste the file's URL, I get a LogIn/Password page which asks for security. After the correct credentials are entered, the file shows up in the browser.

From a PB application, how do I utilize PB's HTTP/REST Client object to display such file without needing to enter the credentials?

 

Thanks!

 

CJ

Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 5 February 2019 08:43 AM UTC
  2. PowerBuilder
  3. # 1

Hi CJ,

your question is wrong:

"how do I utilize PB's HTTP/REST Client object to display such file without needing to enter the credentials"

Since there's authentication enabled on the server, the question should be:

"how do I utilize PB's HTTP/REST Client object to display such file AND enter the credentials"

Sorry for joking a bit :-)

However, I assume authentication is HTTP Basic or Form, depending on the response error code 401 or 302 that you get if you do not input user/pwd.

This said, you need to set the HTTP Basic Authorization by encrypting username and password in Base64 following the header format ("username:password")

Something like:

httpclient http
http = create httpclient
ls_header = 'Basic ' + ls_encoded_Base64
http.SetRequestHeader("Authorization", ls_header)

Here below the API of HTTPClient and CoderObject for your reference:

- https://www.appeon.com/support/documents/appeon_online_help/pb2017r3/powerscript_reference/ch10s38.html
- https://www.appeon.com/support/documents/appeon_online_help/pb2017r3/objects_and_controls/ch02s37.html

Best,

.m

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.