如何从Windows Mobile应用程序调用Web服务到另一台服务器或计算机中发布的网站,而不是在本地计算机中? [英] How to call a webservice from windows mobile application to website published in another server or machine ,Not in the Local machine ?

查看:104
本文介绍了如何从Windows Mobile应用程序调用Web服务到另一台服务器或计算机中发布的网站,而不是在本地计算机中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从Windows Mobile 6应用程序调用Web服务到另一个服务器或计算机上托管的网站.如果我致电该服务,则会在使用以下情况时发生网络异常:

I cannot call the web service from a windows mobile 6 application to a website hosted in another server or machine. If i call the service, webexception will occured and when I use:

catch (WebException ex)
{
  // handels the connection error exception anlong with web response error
  string message = ex.Message;
  HttpWebResponse response = (HttpWebResponse)ex.Response;
  if (null != response)
  {
    message = response.StatusDescription;
    response.Close();
  }
  //end
  MessageBox.Show(message, "Error");
}
Cursor.Current = Cursors.Default;


我收到类似的异常由于内容类型为'application/soap + xml; charset = utf-8; action ="urn:iMAAPExternalServices/TestWCF"无法处理消息"不是预期的类型"application" /soap + msbin1''."请给我一个立即解决方案,以开发我的应用程序.


I got the exception like "Cannot process the message because the content type ''application/soap+xml; charset=utf-8; action="urn:iMAAPExternalServices/TestWCF"'' was not the expected type ''application/soap+msbin1''." Please give me a immediate solution to develop my application.

推荐答案

请参阅这些已解决的线程

See these solved threads

安全令牌服务错误:

其次,在更新安全令牌服务时,在我的默认安装中,我发现没有< system.web>.标记,因此将配置放在</system.net>之后.按照Bill的指示,尝试登录时导致以下错误:

ProtocolException:内容类型为text/html;响应消息的charset = utf-8与绑定的内容类型不匹配(application/soap + msbin1).如果使用自定义编码器,请确保正确实施IsContentTypeSupported方法.

一旦我将<membership><rolemanager>标签封装在<system.web> </system.web>中,一切都很好.感谢此线程 [

Security Token Service Error:

Secondly when updating the Security Token Service, in my default install I found that there was no <system.web> tag, and so placing the config after the </system.net> as instructed by Bill, caused the following error when trying to login:

ProtocolException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+msbin1). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.

Once I enclosed my <membership> and <rolemanager> tags in a <system.web> </system.web> all was good. Thanks to this thread[^] for that solution.


啊---找到了. 网站web.config中的ServiceModel部分设置为customBinding.对其进行了更改,使其与客户端发送的内容匹配,现在可以正常使用了.

Ah --- found it. The ServiceModel section in the website''s web.config was set to customBinding. Changed it so it matched what the client was sending, and now it works beautifully.


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