Access over 20 million homework & study documents

Case study net

Content type
User Generated
Type
Study Guide
Rating
Showing Page:
1/33
Web Services and the .NET Framework
Building a Web Service Client using C# and .NET
Gopalan Suresh Raj
Note
To work with any of these samples, you will need the following:
.........................................Microsoft .NET SDK
.........................................Microsoft Visual Studio.NET Beta 2 or higher
Building Web Service Clients using the .NET Framework
Clients communicate with Web Services using standard web protocols, using XML-encoded
messages to send and receive messages between themselves. This makes it possible for
client applications running on any platform to access web services as long as they use
standard web protocols, and understand the XML-encoded messages. There are three
protocols that web clients can use to communicate with web services namely, HTTP GET,
HTTP POST, and SOAP.
The various steps that are involved in creating a Web Service Client using C# and the .NET
Framework are as follows:
1. Generate a Proxy for the Web Service
2. Compile the Proxy as a DLL library
3. Create a Visual C# - Console Application Project
4. Develop the Client.cs class file
5. Build the Project Files
1. Generate a Proxy class for the Web Service
The .NET SDK simplifies the process of creating Web Service clients by providing the Web
Services Description Language (wsdl.exe) utility. This utility generates proxy source code
for an existing Web Service, just as IDL compilers generate DCOM proxies for DCOM
components. The only difference between IDL and WSDL is that, WSDL is a language that
describes the interface of a software component that is XML-based.
Let us generate source code for the proxies to the actual web service as shown below:
Command Prompt
C:\MyProjects\Cornucopia\WebService\Client>wsdl /l:CS /protocol:SOAP
http://localhost/OIDServer/OIDServer.asmx?WSDL
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 1.0.2914.16]
Copyright (C) Microsoft Corp. 1998-2001. All rights reserved.
Writing file 'C:\MyProjects\Cornucopia\WebService\Client\OIDServer.cs'.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/33
C:\MyProjects\Cornucopia\WebService\Client>
The above command creates a proxy for the OIDServer web service from the WSDL
document obtained from the URL http://localhost/OIDServer/OIDServer.asmx?WSDL.
The proxy uses SOAP as its protocol to talk to the web service and is generated as a C#
source file which is shown below for your perusal.
OIDServer.cs
1:
2:
3:
4:
5:
6:
7:
8:
9:
1
0:
1
1:
1
2:
1
3:
1
4:
1
5:
1
6:
1
7:
1
8:
1
9:
2
0:
2
1:
2
2:
2
3:
2
4:
2
5:
2
6:
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by wsdl, Version=1.0.2914.16.
//
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="OIDServerSoap",
Namespace="http://icommware.com")]
public class OIDServer : System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public OIDServer() {
this.Url = "http://localhost/OIDServer/OIDServer.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://icommware.com/gene
rateOID",
RequestNamespace="http://ico
mmware.com",
ResponseNamespace="http://ic
ommware.com",
Use=System.Web.Services.Descr
iption.SoapBindingUse.Literal,
ParameterStyle=System.Web.Se
rvices.Protocols.SoapParameterStyle.Wrapped)]
public string generateOID() {
object[] results = this.Invoke("generateOID", new object[0]);
return ((string)(results[0]));

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/33

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 33 pages?
Access Now
Unformatted Attachment Preview
Web Services and the .NET Framework Building a Web Service Client using C# and .NET Gopalan Suresh Raj Note To work with any of these samples, you will need the following: .........................................Microsoft .NET SDK .........................................Microsoft Visual Studio.NET Beta 2 or higher   Building Web Service Clients using the .NET Framework Clients communicate with Web Services using standard web protocols, using XML-encoded messages to send and receive messages between themselves. This makes it possible for client applications running on any platform to access web services as long as they use standard web protocols, and understand the XML-encoded messages. There are three protocols that web clients can use to communicate with web services namely, HTTP GET, HTTP POST, and SOAP. The various steps that are involved in creating a Web Service Client using C# and the .NET Framework are as follows: 1. Generate a Proxy for the Web Service 2. Compile the Proxy as a DLL library 3. Create a Visual C# - Console Application Project 4. Develop the Client.cs class file 5. Build the Project Files 1. Generate a Proxy class for the Web Service The .NET SDK simplifies the process of creating Web Service clients by providing the Web Services Description Language (wsdl.exe) utility. This utility generates proxy source code for an existing Web Service, just as IDL compilers generate DCOM proxies for DCOM components. The only difference between IDL and WSDL is th ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just what I needed…Fantastic!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4