tags:

views:

77

answers:

2

I'm new to the WCF, and I'm looking for some advice. In my web app I consumed a web service (R+Click on project - "Add Web Reference") and started coding. My web app is really big, so it was taking forever to compile each time I wanted to debug, so I built a stripped down WinForm using the same code.

In VS2008 there is no "Add Web Reference" option when using the 3.5 framework, so I just chose "Add Service Reference" and used the same url. The objects/methods that I now have access to are completely different when compared to the objects/methods in the web app after consuming this as a web service.

Is that normal? Is this somehow related to the WCF?

Thanks

A: 

Yes this is related to WCF. When your project target is >= .NET 3.0 the Add Service Referemce option will be available which will use svcutil.exe to generate client classes, otherwise you will have the Add Web Reference option which uses wsdl.exe. WCF clients use different classes to call a web service and that's why you get different classes generated.

Darin Dimitrov
So it's normal that using "Add Service Reference" will give me different class/methods, rather than using "Add Web Reference?"
Barryman9000
+2  A: 

You can still add web references.

Do

Add Service Refernce

Hit the "Advanaced" button on the bottom left

Hit "Add Web Reference" on the bottom left.

Kevin
Thanks. I'm not sure I want to consume this as a web service though. From what I've read there are some advantages to the WCF.
Barryman9000
Yeah, I figured you might say that, but I thought I would add it anyway just in case you didn't have a choice and needed to know how to do it.
Kevin
Cool. I didn't know about that advanced option. I changed the selected framework to 2.0, saved and re-opened and the "Web Service" option was there. I should probably stick with the WCF though, right? I'm thinking I'll be thanking myself later.
Barryman9000
It depends if you are starting out new I would think about using WCF if at all possible. If you are upgrading an existing app to 2008, and it has a lot of web service references, you'll probably have to check and see what will change and affect you. WCF is pretty cool (definitely better than web services), but there are some gotchas.
Kevin
OK, its a new project so I'll go with the WCF. However I don't understand why the classes and methods are different. Similar names with similar properties, but definitely not the same as when adding it as a Web Service.
Barryman9000