从 Web 服务返回信息 [英] Returning info from a Web Service

查看:22
本文介绍了从 Web 服务返回信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个组织的支持人员表示,他们的产品无法使用我的网络服务,因为我返回的似乎是 ASCII 编码的信息,而不是 UTF-8 编码的信息.

A support person from an organization indicated that their product wasn't able to consume my web service because it appeared I was returning ASCII encoded information, versus UTF-8 encoded information.

[WebMethod]
public string ReturnAll(){
    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load(@"some_dir\stockresults.xml");
    XmlNodeList nodeList = xmlDoc.SelectNodes(@"/entries/Entry/Company|/entries/Entry/Symbol");
    //public static string value;
    foreach (XmlNode org in nodeList)
    {
      value += org.OuterXml;
    }
    return value;
}

是否有任何在线参考我在上面需要将其更改为正确的编码?在返回信息之前,我是否必须在我的方法中做一些特殊的事情来重新编码信息?

Any online references to what I'd need above to change it to the right encoding? Will I have to do something special in my method to re-encode the information before returning it?

推荐答案

Marco,UTF-8 是默认的.

Marco, UTF-8 is a default one.

检查此配置选项 - http://msdn.microsoft.com/en-us/library/hy4kkhe0(v=VS.90).aspx

这篇关于从 Web 服务返回信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆