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 400 Bad HTTP Request - Parameter with Space ' ' in name

Pyc
Participant
0 Likes
2,489
G'day all,
I'm using CL_HTTP_CLIENT to interact with an external system which offers a URL based interface. This works fine until I have a parameter name with a space in it, at which point I get a "400 Bad HTTP request" response with the following detail:
Error: -21
Version: 7200
Component: HTTP_PLG
Date/Time: Mon May 14 13:40:28 2012
Module: http_plg.c Line: 5613
Server: SYDSVECCDEV_AED_00
Error Tag: {0003b201}
Detail: illegal request version
I'm creating the instance of CL_HTTP_CLIENT via method CREATE_BY_DESTINATION and then passing the rest of the URL by calling method REQUEST->SET_HEADER_FIELD passing name '~request_uri'.
When I pass something like the following it works fine:
?&action="create"&type="account - customer"&id="ACCOUNT926"&priority="12"
But when the parameter has a space such as 'accession number' below, it results in the 400 response.
?&action="create"&type="account - customer"&id="ACCOUNT926"&accession number="12"
I've tried manually replacing the space with %20.
I've tried using the 'IF_HTTP_CLIENT~ESCAPE_URL' method on the string.
I've tried to build the URL extension using method APPEND_FIELD_URL
In each case I get the 400 response.
Can anyone advise how I can successfully call such a URL or if there is just some limitation that means I can't use CL_HTTP_CLIENT in such a scenario??
I should also say that the URL with 'accession number' works fine when run directly in Internet Explorer.
Many thanks,
Mark
(please note I haven't posted on SCN / SDN very often - please shout if this question should be posted somewhere more specific)
1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,548

Hi Mark,

Can you try replacing the space with a '+' sign?

Or you can do the easy thing, by removing the space

Hi Mark,

Can you try replacing the space with a '+' sign?

Or you can do the easy thing, by removing the space

3 REPLIES 3
Read only

Former Member
0 Likes
1,549

Hi Mark,

Can you try replacing the space with a '+' sign?

Or you can do the easy thing, by removing the space

Read only

Pyc
Participant
0 Likes
1,548

Many thanks Shambu! The '+' replacement worked a charm 😄

Read only

Former Member
0 Likes
1,548

Awesome..