简体   繁体   中英

Windows Phone 7 call ASMX web service

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.

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.

In Windows phone programming, you can directly right click on the project name in the Solution Explorer and select Add -> Add Service Reference -- then add your asmx address.

It should work. if not, make sure your address is valid. Try to paste the same in the browser and check if it is giving correct details

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM