1. Pierre DETE
  2. PowerBuilder
  3. Thursday, 9 June 2022 13:17 PM UTC

Hello everyone,

We have implemented a "MS O365 Graph API email sending" procedure in PB using a Client Credentials Workflow. It works well.

Now we need to manage Proxy. 

In java we can connect by adding the proxy parameter to openConnection if necessary :

Such as : 

if (isEmpty(proxyURL)) {
conn = (HttpURLConnection) url.openConnection();
} else {
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyURL,proxyPort));
conn = (HttpURLConnection) url.openConnection(proxy);
}

Now in Powerbuilder... is there a way to add proxy configuration

We have 1rst Get Token and 2nd POST the email

// CLIENT_CREDENTIALS
ltr_Request.clientid = ls_clientid
ltr_Request.clientsecret = ls_clientsecret
ltr_Request.scope = "https://graph.microsoft.com/.default"
ltr_Request.granttype = "client_credentials"ll_Return = loac_Client.AccessToken( ltr_Request, ltr_Response )

 

loar_request.method = "POST"
loar_request.url = "https://graph.microsoft.com/v1.0/users/" + as_from + "/sendMail"
loar_request.setheader ("Content-type","application/json")
loar_request.setheader ("charset","utf-8")
loar_request.setheader ("Authorization", "Bearer " + ls_token)

...

ll_ret = loac_client.RequestResource (loar_request, lrr_response)

 

For now, I can find out how to manage this configuration in Powerbuilder.

According : https://www.example-code.com/powerbuilder/http_proxy.asp

It seems there is a way to set the proxy for all HTTP requests ?

 

Any idea ? Thanks in advance.

 

Pierre

 

 

Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Monday, 13 June 2022 08:51 AM UTC
  2. PowerBuilder
  3. # 1

Hi Pierre,

OAuthClient itself doesn’t support setting proxy, but it can use the system proxy. I will record it as a new enhancement/requirement request and will transfer it to our product team for consideration.

The link you provided introduces a third-part ActiveX solution. You can give it a try, but it doesn’t affect the HTTP requests of objects such as OAuthClient and HTTPClient.

Regards,
Kai

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.