Windows Phone 7的调用ASMX web服务

问题描述:

我要消耗一款Windows Phone 7项目的ASMX Web服务。当我尝试添加Web服务引用,我发现,添加Web引用按钮添加服务引用 - >高级,丢失。

I want to consume an ASMX web service in a Windows Phone 7 project. When I try to add the Web service reference, I found that Add Web reference button in Add Service Reference--> Advance, is missing.

当我将它添加为服务引用一些Web方法失踪。我们可以添加一个基于ASMX Web服务的Windows Phone 7项目。

When I add it as a Service reference some of the web methods are missing. Can we add an ASMX based web service to Windows Phone 7 project.

和帮助在这个问题上,将不胜感激。

And help on this issue would be greatly appreciated.

我找到了答案,几个月前在Windows商店应用工作,同样适用于Windows Phone的。当添加一个服务引用ASMX服务,单击高级按钮,然后选择始终生成消息协定选项。这将导致正确创建的服务。

I found the answer a few months ago working on a Windows Store app, and the same applies for Windows Phone. When adding a service reference to an ASMX service, click the advanced button, and select the 'Always generate message contracts' option. This will cause the service to be created correctly.

在虽然使用这种方法,你的服务类的名字将在年底肥皂。例如,为MyService'将是'MyServiceSoap',你叫将有异步在名称末尾的任何方法。一切应该像以前一样工作。

When using this method though, your service class name will have 'Soap' at the end. For example, 'MyService' will be 'MyServiceSoap' and any method you call will have 'Async' at the end of the name. Everything else should work as before.