开发者

Passing UTF-8 encoded string to SOAP

开发者 https://www.devze.com 2023-01-18 19:22 出处:网络
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

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

  1. NON ASCI开发者_Go百科I characters
  2. UTF-8 encoding
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消