Platform Server Encoding REST Url for SSRS

Platform Server Encoding REST Url for SSRS

  

I'm trying to get a report from our SSRS server, and Outsystems is annoyingly encoding the report parameters in a way which I don't know how to disable.

In Outsystems the URL looks like this:

http://reportbaseuri/ReportServer/Pages/ReportViewer.aspx?%2fReport_Folder%2fReportName&ReportGuid=DAB4CF75-1181-42AB-8810-3CEBE1441AB7&rs:Command=Render&rs:Format=PDF

However, when I execute the request, the server's logs show that the following URL was called:

http://reportbaseuri/ReportServer/Pages/ReportViewer.aspx?%2fReport_Folder%2fReportName%26ReportGuid=DAB4CF75-1181-42AB-8810-3CEBE1441AB7&rs:Command=Render&rs:Format=PDF

As you can see, the ampersand is replaced with %26, which results in a 500 error from our server. Is there any way I can disable Outsystem's native URL encoding?

Hi Jason,

The reason OutSystems is encoding the ampersand, is because the first URL you specificied isn't a proper query string. So the Platform assumes everything up to the first equal sign is the parameter, and encodes it (properly, I might add). So it's not OutSystems at fault, but either SSRS or the way you (try to) send data to it.

I understand the reason, I am trying to work around that, since that is the way that SSRS receives report names.

I ended up ditching the Outsystems REST framework entirely and doing the entire request in a custom extension.

I'm having the same problem when I try to consume some rest services from Microsoft Graph

I would to filter some results by using "$filter=" parameter, but OS encode "$" to "%24" and the Microsoft service doesn't understand it.

There is no other way to workaround this using native rest call, right? Maybe should we use something like  HTTPRequest extension?

Hi Tiago,

Incidently I also consume MS Graph, and I didn't have these problems. For example, to retrieve messages from a certain mailbox, this is the URL Path I used:

/{Version}/users/{UserID}/mailFolders/{FolderID}/messages?$top={Top}&$skipcount={SkipCount}&$count={Count}&$select={Select}&$Filter={Filter}&$orderby={OrderBy}

As you can see, the $Filter, being a parameter, should be on the URL, and not as part of the parameter itself. {Filter} then refers to the content of this Parameter, and is defined with its "Send In" Property set to "URL". Note that in case the Filter Parameter is empty, the Platform doesn't send the $Filter parameter to the REST service, unless you set "Send Default Value" to "Yes".

Kilian Hekhuis wrote:

Hi Tiago,

Incidently I also consume MS Graph, and I didn't have these problems. For example, to retrieve messages from a certain mailbox, this is the URL Path I used:

/{Version}/users/{UserID}/mailFolders/{FolderID}/messages?$top={Top}&$skipcount={SkipCount}&$count={Count}&$select={Select}&$Filter={Filter}&$orderby={OrderBy}

As you can see, the $Filter, being a parameter, should be on the URL, and not as part of the parameter itself. {Filter} then refers to the content of this Parameter, and is defined with its "Send In" Property set to "URL". Note that in case the Filter Parameter is empty, the Platform doesn't send the $Filter parameter to the REST service, unless you set "Send Default Value" to "Yes".


Thanks Kilian for the quick answer

Then the problem is another one.

Basically I'm trying to use this kind of filter

https://graph.microsoft.com/v1.0/groups?$filter={additional}&$expand=members

Where the {additional} is: startswith(displayName,'Company')

In this way is like the filter not work. If I do this by test from Studio it is ok.

I've tried many way, like for example just passing the 'Company' value as a parameter {filter} and the rest of the command directly on URL, but when I do this I have a bad request.

Well, as far as I know, when using quotes in the URL, they are always encoded, en the receiver should either explicitly decode them or that's done automatically.

Kilian Hekhuis wrote:

Well, as far as I know, when using quotes in the URL, they are always encoded, en the receiver should either explicitly decode them or that's done automatically.

yes, strange

I think OS is ignoring the "(" and ")" characters 

On Service Center I can see for example these characters not appearing (%2c is ",")

https://graph.microsoft.com/v1.0/groups?%24filter=displayName%2c'Company'&%24expand  


That is quite weird, the whole "startsWith" seems to be gone as well...

Kilian Hekhuis wrote:

That is quite weird, the whole "startsWith" seems to be gone as well...

lolol

True, but it is really on endpoint

I'm trying many way to understand what is happening

Well, I'd advise you to contact OutSystems Support, as this could well be a bug...

Kilian Hekhuis wrote:

Well, I'd advise you to contact OutSystems Support, as this could well be a bug...

Yes, thanks Kilian for your help.

It could be a bug, really

Just to not impact the project, I've implemented successfully this kind of request using ardoHTTP