2

I currently have a webservice running on a server somewhere, and if i access the webservice locally i can type in anything and it takes the inputs without any problem.

However, when trying to make a http-post to the webservice from the outside with inputs containing chars such as '&' in this scenario, i run into http error 400 -Bad request.

The below screenshot is a screenshot of the google-chrome addon/in poster, which allows me to make posts to my server.

So, what i'm trying to figure out is why the server doesnt like the request when special characters are part of the inputs.

Chrome addon Poster

Any ideas/tips and/or pointers will be highly appreciated.

Thanks in advance.

Edit: Please assume that i have a function in the webservice that recieves a string as input.

Jens Bergvall
  • 1,617
  • 2
  • 24
  • 54

1 Answers1

2

Probably the text is not properly urlencoded. If you are using GET protocol, the query becomes:

?bar1=12345&&bar2=something

Try sanitizing (urlencode) string before negotiating with your webservice.

jerrymouse
  • 16,964
  • 16
  • 76
  • 97
  • The posts are being sent one by one, the above picture can be misleading. I also never use the GET protocol, i'm explicitly using POST. – Jens Bergvall Mar 12 '12 at 12:50
  • Yeah, the thing is, i am encoding the poststring before sending it within my client-environment. I still get 400 :/ – Jens Bergvall Mar 12 '12 at 12:54
  • i had to replace & with & – Jens Bergvall Mar 12 '12 at 14:05
  • Just to clarify, use Server.UrlEncode on string arguments your sending to your webservice. Then use Server.UrlDecode into your webservice function to get the genuine string. Fixed my problem with special non-character ASCII code. – Matt Roy Jun 09 '17 at 12:52