开发者

WP7, How to use a service reference after adding it to Visual Studio 2010

开发者 https://www.devze.com 2023-01-26 20:57 出处:网络
I\'m following this example for connecting to the Bing Maps geocode service: Link About half way down the page, it explains how 开发者_开发知识库to add a service reference in Visual Studio 2010, which

I'm following this example for connecting to the Bing Maps geocode service:

Link

About half way down the page, it explains how 开发者_开发知识库to add a service reference in Visual Studio 2010, which I was able to do successfully. Then it says to add "using GeoCode.GeoCodeService", but when I do, I get an error saying "The type or namespace 'GeoCode' could not be found"

Am I doing something wrong. The steps are pretty simple and nothing gave an error. What else do I need to do in order to access the service?


After you added a Reference using your WSDL URL:

Under Solution, under Service References, right click on your Service Reference folder that you want to reference (example: com.gold.services.description1)

Select View in Object Browser. You will see the class name in the Object Browser window that will open up. (example: GoldWeb.com.gold.services.description1)

Copy and paste the class name into your code.

Example:

using GoldWeb.com.gold.services.description1;

Then you are ready to start using its classes.


When you added the service reference, you gave it a class name. Have a look in your solution explorer to see what you called it, and then you have to instantiate that class to use the service.


I seen this happen, when a service may be added to one project and is being back referenced in another project. For instance, the main project has the service reference, but library code, that's is reference in the main project, tries to instantiate the webservice. This is a circular/backreference and you can't add the namespace of the main project back into the library project, since the library project is already reference into the main project. I know this seem obvious, but in really big projects, it's easy to get lost to where you're at in code.

0

精彩评论

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

关注公众号