Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2005, 05:20 AM
Registered User
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How? Schema to Vis Studio Web Reference

How do I take schemas from a third party Web Service (along with URL) and get it as a Web Reference in an ASP.NET Project?
 
Old June 18th, 2005, 01:12 AM
Authorized User
 
Join Date: May 2004
Posts: 83
Thanks: 0
Thanked 1 Time in 1 Post
Default

Assume that we've a web service @ http://localhost/websvc/strsvc.asmx. In order to add a web reference to this service the way you asked, you must follow the following steps:

1) Open Visual Studio.NET Command prompt.

2) Enter command: disco http://localhost/websvc/strsvc.asmx /out:c:\websvc; Press enter. The disco.exe tool will generate some files that contain info about the web service in the specified directory (c:\websvc).

3) Enter command: wsdl c:\websvc\strsvc.wsdl /l:cs /o:c:\websvc\strsvc.cs; Press enter. The wsdl.exe tool will generate a C# source file containing the proxy class for the web service.

4) Create a new Windows Application project in Visual Studio.NET.

5) Add a reference to the assembly System.Web.Services.dll.

6) Right-click your project, select Add Existing Item, browse to c:\websvc and open strsvc.cs.

7) That's all! You've a web reference to your web service. Now you can create instances of your web service and invoke methods on it.

For detailed information on how the disco.exe and wsdl.exe tools work, please look into the .NET Framework SDK Documentation.

Regards,

ejan
 
Old June 18th, 2005, 02:34 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I may be missing something, but can't you let VS.NET do all the hard work? All you need to do is right-click the project, choose Add Web Reference, browse to the service, click Add and be done with it....

Or is there an advantage of using the disco tool??

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 19th, 2005, 05:11 AM
Authorized User
 
Join Date: May 2004
Posts: 83
Thanks: 0
Thanked 1 Time in 1 Post
Default

You're right. That's the easiest way of doing that. But, the thing is, I assumed Alderian72 already knew that method. After all, someone talking about web services should know, at the very least, that we can add reference to a web service by right cliking a project and selecting Add Web Reference. So, I went the other way around.

Any way, now Alderian72 knows both the ways of doing the same thing: adding a reference to a web service :D.

ejan
 
Old July 9th, 2005, 05:14 PM
Registered User
 
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe I'm doing something wrong, but following the method I just get a warning that no classes were generated.
The disco part worked and the files were created there
I'd use the IDE method to add a web reference if I could figure out the proxy crap that just messes up IE for me.
In either case, I'm getting frustrated with this process.
TIA for any suggestions and by the way, I'm working with VB rather than C#
Tim

 
Old July 9th, 2005, 05:28 PM
Registered User
 
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I tried adding the web reference to my project using the files generated by using the disco utility and voila! I can add a web reference to my project.
I can't understand why i couldn't just go to the web service I had created when making the sample project in the distributed application walkthrough. All I got from that was a bunch of errors.
anyway..........thanks Ejan for your tip. I tried using MSDN documentation and their command line methods to no avail.
I'm probably going to be making lots of requests in this forum.

 
Old July 9th, 2005, 06:46 PM
Registered User
 
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well as expected, unless I can generate a class I can't use the web reference properly
:(






Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Programming using VB.net and Vis Studio.net anglospice Wrox Book Feedback 3 August 21st, 2003 08:02 AM
Web Programming using VB.net and Vis Studio.net anglospice VS.NET 2002/2003 0 August 20th, 2003 05:26 PM
Creating a project on my server with Vis Studio? BradDotNet BOOK: ASP.NET Website Programming Problem-Design-Solution 2 July 29th, 2003 08:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.