Url with special characters

Hi all

I have an URL that looks as follow:

http://example.com/sap/opu/odata/sap/ZQM_WP_ODATA_SERVICES_SRV/PlantInfoSet(‘8887’)

I use HTTPoison.get for request to the server

HTTPoison.get(“http://example.com/sap/opu/odata/sap/ZQM_WP_ODATA_SERVICES_SRV/PlantInfoSet(‘8887’)”, %{“Accept” => “application/json”})

and it response with

Ressource could not be found

I think because of the special character.

When I use POSTMAN for the request, it works as expected.

How can I solve the problem?

Thanks

On the server what is the path that is being requested after processing? If something is being munged or converted then a bug report should probably be given to HTTPoison.

The server receive the URI as:

/PlantInfoSet%28%278887%27%29

That’s why the server could not find URI.

That looks like a correctly encoded URL, sounds like a broken server then if it does not understand that.

EDIT: Or do you mean that the /sap/opu/odata/sap/ZQM_WP_ODATA_SERVICES_SRV part is missing, in which case sounds like HTTPoison bug but I have no clue how that would even happen…

As far as I can remember, the SAP2HTTP bridge is pretty borked, and it might be even worse (or better) when there is a layer of proxies in the way.

@kostonstyle, is the content served by an SAP instance directly or is there some other stuff inbetween?

Just for the record, http://example.com/a and http://example.com/%61 are identical. If you can’t convince your layer of routing/accessing SAP from this fact, then you need to identify the one that doesn’t acknowledge proper escapes and file a bug report recursively (there might be more than only one faulty instance!).

1 Like

The content is served directly by SAP instance, there is nothing between.

I use elixir as a proxy server, that forward frontend stuff to SAP server.

When I request with POSTMAN with the same URI, then I’ve got the expected response from the SAP, why? What is difference between POSTMAN and HTTPoison?

I can’t find postman on hex, a googlewide search does show me thousands of entries of a movie by Kevin Costner (which I wan’t to watch again now…), so could you please provide a link to what postman you mean?

1 Like

Here we go https://www.getpostman.com/

Well the main difference seems to be that it does not adhere RFC 3986, which defines reserved character in Section 2.2 which have to be escaped.

So HTTPoisons behaviour of escaping (, ), and ' is correct, all other software in your toolchain seems to behave wrong, please report bugs.

1 Like

I think because it is odata, that maybe they do not follow RFC 3986 convention. I have to check on SAP.

Thanks so much for your help.