Clicky

I am attempting to work with a web service, http://msrmaps.com/terraservice2.asmx

I have created a C# Windows phone application in VS.NET as per instructions from on an online tutorial from LearnVisualStudio.net.

I have added the Web Service by right-clicking on the project (called DeleteMe8), choosing "Add Service Reference" and pasting the above URL into the Address box and naming this new Service Reference "myChicken"

then, on a button_click event on a button on the main page xaml file, I have the following code:

            myChicken.TerraServiceSoapClient client = new myChicken.TerraServiceSoapClient();

This again is as per the tutorial on LearnVisualStudio.net

the next line of code is meant to generate an event handler.  On the next line, by typing "client.", the intellisense should pop up and show me a list of properties, methods and events.  See phone-app.png.  From here I can create an event handler and all is well.

The problem is this:  I'm trying to do the same thing in a C# Windows Form application.  Bear in mind that I am pretty new to Visual Studio and C#.  But I'm pretty sure I included the same list of references and Using statements, etc.  I created a Windows form and behind the button on the form I tried to replicate what I have described above.  However, this time when I get to the line where I want to type "client.", the intellisense does NOT show me any events.  See windows-form-app.png.

I don't know why one app shows events and not the other.  There are no compile errors.

asked 11/29/2011 12:36

tjeffryes's gravatar image

tjeffryes ♦♦


4 Answers:
It appears your phone project created a reference using the older style of "Add Web Reference" and the forms project used the more recent "Add Service Reference"--I realize you said you used "Add Service Reference" in your phone project; this is just what it appears to look like for me. You can create a class similar to what you have in the phone project by using the command line utility wsdl.exe. You can easily get access to this utility by opening up a Visual Studio Command Prompt (Start->Programs->Visual Studio 2XXX->Visual Studio Tools->Visual Studio Command Prompt). A command line you could use:

wsdl.exe /n:mychicken /o:C:\path\to\output\file.cs http://msrmaps.com/terraservice2.asmx


You would then add the resulting file to your project using "Add Existing." You would no longer need the reference you previously added. Once you do that, you should get something similar to what you had:
link

answered

kaufmed's gravatar image

kaufmed

Wow.

Being a relative newbie (been programming for 18 years, but new to .NET and C#), I have NO CLUE as to how you knew all that.  

But ti worked!!!

My only additional question would be, where can I get more information to understand how you knew this stuff.  Is it pretty specific to VS and Web Services?

Thanks very much!!!
link

answered 2011-11-29 at 21:06:35

tjeffryes's gravatar image

tjeffryes

where can I get more information to understand how you knew this stuff.

For me, it's just experience--stuff I picked up as I came across it. I've done LOTS of "googling" over the past few years--still do! I know that's not the most ideal answer you'd want to hear, but it's as honest as I can be. In any event, you can find the docs for wsdl.exe ( "Add Web Reference" ) and other utilities like svcutil.exe ( "Add Service Reference" ) and xsd.exe ( convert schemas to class representations [helpful for XML serialization] ) on MSDN--the easiest way to find them is to web search the individual names rather than directly navigating MSDN.

Is it pretty specific to VS and Web Services?

To VS: yes.
To Web Services: just with respect to .NET. I'm sure other languages have their utilities for working with WSDL files and the like.
link

answered 2011-11-29 at 21:38:34

kaufmed's gravatar image

kaufmed

Thanks again.  That's great stuff.

Yes, I'm pretty adept in general at using Google for searching.  But sometimes, especially at the beginning stages, when nothing seems to go right, it's hard to know what one is looking for.  

I read your profile. You sound like a great person.  Thanks again for all your help.

Tim
link

answered 2011-11-29 at 21:45:05

tjeffryes's gravatar image

tjeffryes

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×59
×156
×37
×10

Asked: 11/29/2011 12:36

Seen: 184 times

Last updated: 11/29/2011 01:38