views:

537

answers:

3

I just hit a huge brick wall with Paypal. I had created a regular C# project to create some wrapper classes using their WSDL.

If you create a non-web project, the only option you get to add a wsdl is a Web Service Reference. And this builds kinda the same set of proxy classes as a Web Reference would but not really..it adds more that even the PayPal guys are not aware of.

So I was this entire time looking for the right Interface in this list of proxy classes to use as the service (SoapBinding) and the PayPalAPIAASoapBinding was not there I kept telling our PayPal point in contact.

I could only see the following 2 Interfaces that appeared to me what I needed to use since I did not see a PayPalAPIAASoapBinding which you CAN see in a Web Reference based service reference:

PayPalAPIAAInterfaceClient
PayPalAPIInterfaceClient 

So I figured out oh, I probably had created a Service Reference vs. a Web Reference which Web Reference is an option in a Web project. But I don't want my service reference tightly coupled to my web project. So that's why I created the C# Project.

So what the heck is a Service Reference vs. Web Reference? And how am I supposed to separate this out into anther project if Service Reference is going to throw me a loop and give me a set of different interfaces than a Web Reference would?

Also, to make things even MORE confusing, VS 2008 has a Web Service Application project.

So what do I use? We're using the .NET 3.5 framework and we're not ready to move to WCF. So can I still use the new Service Reference even if not using WCF or what? IF you're using .NET 3.5 and not WCF yet and you still want to do basic web services, do you still go the Service Reference route and just not use the WCF framework? Meaning can it be used like a .NET 2.0 Web Reference still, just that you're going to get an entirely different generation of the WSDL?

+2  A: 

Adding a service reference allows you to create a WCF client, which can be used to talk to a regular web service provided you use the appropriate binding. Adding a web reference will allow you to create only a web service (i.e., SOAP) reference.

If you are absolutely certain you are not ready for WCF (really don't know why) then you should create a regular web service reference.

Otávio Décio
CoffeeAddict
@coffeeaddict I think you and your boss are mis-informed. Both types of references will create a class which provides methods to call the service operations. How is it relevant that the class created by a "service" reference happens to inherit from a base class which happens to be in a library that Microsoft considers to be part of some technology it calls WCF?
Daniel Pratt
A: 

If I understand your question right:

To add a .net 2.0 Web Service Reference instead of a WCF Service Reference, right-click on your project and click 'Add Service Reference.'

Then click "Advanced.." at the bottom left of the dialog.

Then click "Add Web Reference.." on the bottom left of the next dialog.

Now you can add a regular SOAP web reference like you are looking for.

Moose
+4  A: 

Add Web Reference is the old-style, deprecated ASP.NET webservices (ASMX) technology (using only the XmlSerializer for your stuff) - if you do this, you get an ASMX client for an ASMX web service. You can do this in just about any project (Web App, Web Site, Console App, Winforms - you name it).

Add Service Reference is the new way of doing it, adding a WCF service reference, which gives you a much more advanced, much more flexible service model than just plain old ASMX stuff.

Since you're not ready to move to WCF, you can also still add the old-style web reference, if you really must: when you do a "Add Service Reference", on the dialog that comes up, click on the [Advanced] button in the button left corner:

alt text

and on the next dialog that comes up, pick the [Add Web Reference] button at the bottom:

alt text

marc_s
+1 Your answer is more helpful with the pretty pictures.
Moose
interesting, since when can we add pics to posts! nice! You must have done via url?
CoffeeAddict
How stupid is that for MS to hide that in a WCF dialog box! Doesn't even make any sense with the placement here
CoffeeAddict
@coffeeaddict: well, I think MS is trying to subtly sway you towards using WCF by default - and only old-style ASMX if you're really determined :-)
marc_s