HI,
The following code works fine with OE 11.6.2, but fails with 11.7
De request.log points to C:\Temp\request-raw.txt which containes the following :
OpenEdge 11.7
POST /?token=AwYAAAD57FoHGPLsV4Z3UbF+HOUcwUsVYFJ+hli2hLE5NLyL2AnJD50x9eitoUyYaMLasiPCvJyKY1cmFvSi0E+xFrQSPCmDEDL0019wmJSU9aKSKjR2f6MAlNlzd8t4iutjnjM= HTTP/1.1
OpenEdge 11.6.2
POST /?token=AwYAAAD57FoHGPLsV4Z3UbF%2BHOUcwUsVYFJ%2Bhli2hLE5NLyL2AnJD50x9eitoUyYaMLasiPCvJyKY1cmFvSi0E%2BxFrQSPCmDEDL0019wmJSU9aKSKjR2f6MAlNlzd8t4iutjnjM%3D HTTP/1.1
I found https://knowledgebase.progress.com/articles/Article/URI-Encode-works-differently-in-11-7-encodes-the-equal-sign and base on that article I constructed the url as is done for variable oURI2 in the code.
In that case both 11.6.2 and 11.7 fail the request. The query string in C:\Temp\request-raw.txt is :
POST /?token=AwYAAAD57FoHGPLsV4Z3UbF%252BHOUcwUsVYFJ%252Bhli2hLE5NLyL2AnJD50x9eitoUyYaMLasiPCvJyKY1cmFvSi0E%252BxFrQSPCmDEDL0019wmJSU9aKSKjR2f6MAlNlzd8t4iutjnjM%253D HTTP/1.1
Can anyone point me in the right direction to make this work for 11.7?
What am I doing wrong?
Thnx in advance!
Kind regards,
Johan Beumer
using OpenEdge.Net.*. using OpenEdge.Net.HTTP.IHttpRequest. using OpenEdge.Net.HTTP.IHttpResponse. using OpenEdge.Net.HTTP.RequestBuilder. using OpenEdge.Net.HTTP.ClientBuilder. using OpenEdge.Core.String. define variable oRequest as IHttpRequest no-undo. define variable oRequestBody as String no-undo. define variable cToken as character no-undo. define variable oResponse as IHttpResponse no-undo. define variable cChannel as character no-undo. define variable oURI as URI no-undo. define variable oURI2 as URI no-undo. session:error-stack-trace = true. session:debug-alert = true. log-manager:logfile-name = 'request.log'. log-manager:logging-level = 6. log-manager:clear-log(). cToken = "MySecretToken". cChannel = "https://bl2p.notify.windows.com/?token=AwYAAAD57FoHGPLsV4Z3UbF%2BHOUcwUsVYFJ%2Bhli2hLE5NLyL2AnJD50x9eitoUyYaMLasiPCvJyKY1cmFvSi0E%2BxFrQSPCmDEDL0019wmJSU9aKSKjR2f6MAlNlzd8t4iutjnjM%3D". oRequestBody = new String('<?xml version="1.0" encoding="UTF-8"?><xml version="1.0" encoding="utf-8"></xml>'). oURI = URI:Parse(cChannel). oURI2 = OpenEdge.Net.URI:Parse(oURI:BaseURI). oURI2:AddQuery("token",URI:encode(oURI:GetQueryValue("token"), UriEncodingTypeEnum:default)). oRequest = RequestBuilder:Post(oURI / oURI2, oRequestBody) :ContentType("text/xml") :AddHeader("X-WNS-Type", "wns/toast") :AddHeader("Authorization", "Bearer " + cToken) :Request. oResponse = ClientBuilder:Build():Client:Execute(oRequest). message oResponse:statuscode skip view-as alert-box information buttons ok.
Since you asked, I looked at the service packs and the issues that were solved with them. For 11.7.3 there has been a change for the issue I'm running into. I installed sp3 and now I got it working. Although still not the way it works in 11.6.2 but I'm satisfied!
In 11.6.2 it's enough to say :
oURI = URI:Parse(cChannel).
In 11.7 you still have to construct a new URI-object like this :
oURI = URI:Parse(cChannel). oURI2 = OpenEdge.Net.URI:Parse(oURI:BaseURI). oURI2:AddQuery("token",URI:encode(oURI:GetQueryValue("token"), UriEncodingTypeEnum:default)).
Peter, thnx for asking!
Kind regards,
Johan Beumer
No service pack. Should I use one?
Since you asked, I looked at the service packs and the issues that were solved with them. For 11.7.3 there has been a change for the issue I'm running into. I installed sp3 and now I got it working. Although still not the way it works in 11.6.2 but I'm satisfied!
In 11.6.2 it's enough to say :
oURI = URI:Parse(cChannel).
In 11.7 you still have to construct a new URI-object like this :
oURI = URI:Parse(cChannel). oURI2 = OpenEdge.Net.URI:Parse(oURI:BaseURI). oURI2:AddQuery("token",URI:encode(oURI:GetQueryValue("token"), UriEncodingTypeEnum:default)).
Peter, thnx for asking!
Kind regards,
Johan Beumer