-----------------------------------------------------------

New Message on cochindotnet

-----------------------------------------------------------
From: Nasha
Message 1 in Discussion

 
Hey Guys,  
All of us have worked with web services but very of us have worked with the 
command line tools provided by .Net framwork. Today we will discuss Net 
Webservice Tools disco.exe and wsdl.exe.  
Disco.exe :-  
Discovey is the most important step when it comes to webservices. This tool 
discovers the URL's of XML webservices on a given web server. Discovery of 
webservices is important for its consumers as from the discovery document they 
can know about the various services they can consume.  
This tool locates the webservice. If it finds the webservice it creates wsdl, 
.xsd, .disco, and .discomap files and if it does not then the error message 
displayed to the user.  
Let us use this tool to discover our webservice and create the above files:  
1) Go to the VS.NET command prompt  
2) Run disco.exe /? for checking out all the options  
3) This is a list of some important options :  
/nosave - Do not save the discovered documents or results to disk (for example 
wsdl, xsd and disco files). The default is to save the documents. 
/out:<directoryName> The output directory to save the discovered documents in. 
The default is the current directory. Short form is '/o:'. 
/username:<username> 
/password:<password> 
/domain:<domain> The credentials to use when the connecting to a server that 
requires authentication. Short forms are '/u:', '/p:' and '/d:'. 
/proxy:<url>The url of the proxy server to use for http requests.The default is 
to use the system proxy setting.  
4) To discover the disco files of the webservice give the URL of the web 
service as  
disco.exe http://localhost/MyWebservice/service1.asmx /nosave . 
If the URL is found the following message will be displayed to you :  
Microsoft (R) Web Services Discovery Utility 
[Microsoft (R) .NET Framework, Version 1.0.3705.0] 
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.  
Disco found documents at the following URLs: 
http://localhost/MyWebservice/service1.asmx?disco 
http://localhost/MyWebservice/service1.asmx?wsdl 
5) We will now perform the same command without /nosave option to save the 
document in MyWebSerDocs folder. Please see to it  
that the directory exists as this tool does not create the directory  
disco.exe http://localhost/MyWebservice/service1.asmx /out:MyWebSerDocs  
6)You should see a similar output  
Microsoft (R) Web Services Discovery Utility 
[Microsoft (R) .NET Framework, Version 1.0.3705.0] 
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.  
Disco found documents at the following URLs: 
http://localhost/MyWebservice/service1.asmx?disco 
http://localhost/MyWebservice/service1.asmx?wsdl  
The following files hold the content found at the corresponding URLs: 
MyWebSerDocs\service1.disco <- 
http://localhost/MyWebservice/service1.asmx?disco 
MyWebSerDocs\service1.wsdl <- http://localhost/MyWebservice/service1.asmx?wsdl  
The file MyWebSerDocs\results.discomap holds links to each of these files.  
7) Check out the directory it should have all the above 3 files i.e. 
Service1.disco, Service1.wsdl and results.discomap 
 
8) Similarly you can discover any web service with this tool and create the 
.disco, .wsdl and discomap files.  
9) These files that we have generated with disco.exe can be used as an input to 
wsdl.exe to create our webservice proxy class.  
WSDL.exe :-  
This tool is used to generate webservice proxy class. This file contains all 
the details for its clients to use when they are interacting  
with the webservice.  
Let us create the webservice proxy class:  
1) Go to VS.Net command prompt  
2) Type wsdl.exe /? to view all the options  
3) I have listed a few important options below :  
<url or path> - A url or path to a WSDL contract, an XSD schema or discomap 
document.  
/language:<language> - The language to use for the generated proxy class. 
Choose from 'CS','VB', 'JS' or provide a fully-qualified name for a class 
implementing 
System.CodeDom.Compiler.CodeDomProvider. The default is 'CS' (CSharp).  
/server Generate an abstract class for an xml web service implementation using 
ASP.NET based on the contracts. The default is to generate client proxy 
classes.  
/out:<fileName> 
The filename for the generated proxy code. The default name is derived from 
the service name. Short form is '/o:'.  
/protocol:<protocol> Override the default protocol to implement. Choose from 
'SOAP', 'HttpGet','HttpPost', or custom protocol as specifiied in the 
configuration file.  
4) To generate the proxy class you can either use .wsdl or .discomap file that 
we have generated using the disco.exe or you can give the webservice url as 
input.  
5) We will create our proxy class using the .wsdl and .discomap files that we 
had generated.  
6) Type the following command : 
wsdl.exe Service1.wsdl  
or  
wsdl.exe results.discomap.  
Service1.cs class will be generated.  
7) You can use this proxy class with any of the client application to interact 
with the webservice.  
8) Create a client application say a Windows application and add the proxy 
class to it by choosing Add Existing Item and selecting out proxy class 
Service1.cs. Create the webservice object and call any method on it.  
Service1 myWebSer = new Service1(); 
MessageBox.Show(myWebSer.HelloWorld());  
  
-- Please post your queries and comments for my articles in the usergroup for 
the benefit of all. I hope this step from my end is helpful to all of us.  
Regards, 
Namratha (Nasha) 
  
  
 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/cochindotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to