Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Derik Whittaker

Thoughts on Software Development, .Net, OOP, Design Patterns and all things cool



Referencing 2.0 Web Services (asmx) in Visual Studio 2008

Recently I needed to add a reference to a classic (.Net 2.0) web service inside a new project that was being created via Visual Studio 2008. 

Now, I have not done a lot of work with WebServices in the past 6-9 months, but thought it would be cake.  Please keep in mind, the service I wanted to connect to was NOT a WCF Service, it was a standard ASMX service.

Below is what I thought would work, but did not

  1. Attempt to Add A Service ReferenceAddAServiceReference
  2. Choose Services in Solution (my Project is in the same solution file).
    ServicesInSolution 
  3. View the generated service implementation.
    IncorrectGeneratedService
  4. WCF Style code implementation
    WCFStyleImplementation 

What you will notice from step 4 is that the way you go about implementing this service is in the WCF style.  This is not what I was looking for.  I was wanting to reference this like all the other code in our projects.

Below is what DID work

  1. Attempt to Add A Service ReferenceAddAServiceReference
  2. Need to click the Advanced button
    ClickAdvancedButton 
  3. Need to add the service as a Web Reference
    ClickAddWebReference 
  4. Finally need to search for and find your web service
     AddWebReference
  5. Lastly, if you have done everything correctly, you should see the following.
    CorrectlyGeneratedService

Now I know that the preferred service type is now WCF, but come-on not everyone is using WCF just yet.  Adding a traditional web service reference is way too much friction.  Why is not possible to add a reference from the solution explorer?  Really can anyone answer me that.

Till next time,

[----- Remember to check out DimeCasts.Net -----]


Published Jul 21 2008, 12:55 PM by Derik Whittaker
Filed under:

Comments

Visual Studio Hacks said:

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Lisa Feigenbaum is looking for feedback on a potential Call Hierarchy feature on The Visual Basic Team blog. Visual Studio 2008 KB

# July 23, 2008 1:43 PM

Brian Johnston said:

You ain't kidding.  Not to mention I find the WCF style kludgy to use - the 2.0 style is much simpler and 'in-line' with traditional programming in my view - 1) create object, 2)call method on object, 3)do something with result, 4)dispose object - the web service is just another set of objects as far as the code *you* are writing is concerned.

# July 24, 2008 8:08 PM

Dave Schinkel said:

Thanks for all the clicks MS.  What a pain in the ass.  That could cause some people a good hour worth of time.

# July 28, 2008 8:58 PM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# July 28, 2008 8:59 PM

gkt said:

Thanks for the info. Porting my old app to work with .net 2008, i also came across this problem. Another issue that i have is -

i add the solution to sourcesafe along  with web service and all seems fine.

If another sourcesafe user tries to get the solution, the webservices creates another directory under projects. Any idea how i can get the source code of webservice  to be in c:\inetpub\wwwroot\projectWebService.? .  If i delete my entire solution and get new solution from sourcesafe everything works fine.

# August 25, 2008 9:47 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Derik Whittaker

Derik is a .Net Developer/Architect specializing in WinForms working out the northern suburbs of Chicago. He is also believer and advocate for Agile development including SCRUM, TDD, CI, etc.

When Derik is not writing code he can be found spending time with his wife and young son, climbing on his bouldering wall, watching sports (mostly baseball), and generally vegging out. Check out Devlicio.us!

Our Sponsors

Red-Gate!