Passing UTF-8 encoded string to SOAP
I am using a third party Web Service. I am passing a string to a function in that service, that string, which i am reading from a UTF-8 text file. The problem it that the string contain some non ASCII characters.
Now if i save that text file to ANSI format, read it in a string and pass that string to Service then it works smoothly but with UTF-8 encoded string the service throw exception "The request failed with HTTP status 400: Bad Request."
Long story short
- NON ASCI开发者_Go百科I characters
- UTF-8 encoding
- SOAP
I am using ASP.NET.
The sample client-side code that you tried with UTF-8 string being passed to the 3d-party web service call, was implemented using an ASP.NET web page/UI or something non-visual (i.e. a simple console C# program?). In other words, I'd like to know whether the content of the UTF-8 file is directly loaded at the server-side (in your ASP.NET) code or you are passing the content from an HTTP client-side context first (using HTTP POST/Upload).
If you are doing it directly, without involving an HTTP web browser, then it may be that that web service implementation might not accept UTF-8 encodings for that string arg. Try doing the same with another ws client (using a different language/platform such as C++ or Perl). This will confirm whether the ws implementation is ok with accepting UTF-8.
精彩评论