- Pierre DETE
- PowerBuilder
- Thursday, 9 June 2022 01: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
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.