Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 607
CACuzcatlan Avatar asked Nov 24 '10 00:11

CACuzcatlan


People also ask

How do I add a service reference in Visual Studio 2010?

Open Microsoft Visual Studio. Open your project or create a new one. In the Solution Explorer right-click on YourSolution/YourProject/References. Select "Add Service Reference..." from the context menu.

How do I add a service reference in Visual Studio?

In Solution Explorer, right-click the name of the project to which you want to add the service, and then click Add Service Reference. The Add Service Reference dialog box appears. In the Address box, enter the URL for the service, and then click Go to search for the service.

How do you call a service reference in C#?

In the Project Type pane, select a Visual C# application. In the Templates pane, select a Windows Forms Application. Enter a project name such as CallingServiceExample, and browse to a storage location. In the Solution Explorer, right-click the project name and click Add Service Reference.

How do I add a Web service reference in Visual Studio 2015?

In Solution Explorer, right-click the name of the project to add the Web service to and then click Add Web Reference. The Add Web Reference dialog box is displayed. In the URL box, enter the URL of the Web service to use. If you do not know the URL, use the links in the browse pane to locate the Web service you want.


2 Answers

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.

like image 195
live-love Avatar answered Sep 21 '22 11:09

live-love


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.

like image 41
Darbio Avatar answered Sep 25 '22 11:09

Darbio