Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_HTTP_CLIENT strips duplicate parameters from URI

Pyc
Participant
1,510

G'day all,

I'm having an issue calling a URL which contains duplicate parameters because CL_HTTP_CLIENT is stripping out the duplicates.

The URI is in the form like:

?&action="CREATE"&type="Project"&id="MA-00178"&actype="Vendor"&acid="0000100020"&actype="ProjectAppropriation"&acid="MA00178"

When the request leaves SAP it's in form:

?&action="CREATE"&type="Project"&id="MA-00178"&actype="ProjectAppropriation"&acid="MA00178"

I've debugged down to a level within the class where the parameters are taken from the URI and formatted into a table of name value pairs and is then passed down to a C level routine which I can only assume deletes duplicates from the table before reconstructing the URI.

Is there anyway to prevent this?

Many thanks,
Mark

4 REPLIES 4
Read only

Former Member
0 Likes
1,226

Hi

Did you ever get to the bottom of this? I think I have debugged into the same bit of code and can see a system-call that seems to overwrite any duplicate/subsequent URL query parameters with the first value.

I can't seem to find a general agreement in "HTTP Land" how duplicate query parameters should be handled but there is a discussion here: http://stackoverflow.com/questions/1746507/authoritative-position-of-duplicate-http-get-query-keys

Cheers,

Simon

Read only

0 Likes
1,226

G'day Simon,

Unfortunately the detail of this is lost is a client email system, but in the end I believe the solution was to ensure that parameter names were unique. I was in the fortunate position of designing both sides of the solution and so could work around the limitation.

Given the stripping happens down in C you can't do much other than request SAP's help. Given the variety of responses in your link I can imagine that SAP may do it on purpose 'to be safe' or 'consistent' - i.e. regardless of the receiving system the solution will work consistently, unfortunately consistently with duplicates removed.

Good luck,

Mark

Read only

UweFetzer_se38
Active Contributor
0 Likes
1,226

I was in the fortunate position of designing both sides of the solution

First of all I would change the request from a GET to a POST, because you want to "CREATE" something.

This would also have the advantage, that you can fill the request body with whatever you want (XML, JSON, plain text), even dublicate parameters.

Read only

0 Likes
1,226

There is a note about duplicate parameters being overwritten, see SAP note 1856171.

https://service.sap.com/sap/support/notes/1856171