2. 2
Agenda
What is a Web service?
Technologies used
XML, SOAP, WSDL, DISCO, and UDDI
Walkthrough creating a Web service
Walkthrough creating a Web service client
References
Q&A
3. 3
What is a Web Service?
A programmable application component that
is accessible via standard Internet protocols
Web page with functions
Available for a variety of clients
Examples: stock quotes, traffic conditions,
calculators, news, weather, et cetera
4. 4
Technologies Used
Standard way to represent data
XML (and XML schemas)
Common, extensible message format
SOAP
Common, extensible contract language
Web Services Description Language (WSDL)
Way to discover site services
Disco
Way to discover service providers
Universal Description, Discovery, and Integration (UDDI)
5. 5
XML
Extensible Markup Language
Language for describing documents with
structured data
Industry standard
XML Schemas – XSD
XML based
Language for describing data types
For more information, read:
http://msdn.microsoft.com/library/en-us/dnwebsrv/html/xmloverchap2.asp
6. 6
SOAP
A simple, XML-based protocol for
exchanging structured and type information
on the Web
Industry standard
Lightweight and XML-based protocol
Can support different protocols and formats:
HTTP, SMTP, and MIME
SOAP message
For more information, read:
http://msdn.microsoft.com/soap/
7. 7
WSDL
It is an XML document describing Web
services
Define data types (XSD)
Define messages in terms of types
Define bindings to transport protocol, message
format
SOAP 1.1, HTTP Get/Post, MIME
Define services as collections of ports
WSDL.exe
For more information read:
http://msdn.microsoft.com/library/en-us/dnwebsrv/html/wsdlexplained.asp
8. 8
DISCO
Document Discovery
A client finds a particular Web services by
discovery
Document discovering services at a
particular URL
Document is in XML format
Document has .disco and .vsdisco
extensions
Disco.exe
9. 9
UDDI
Universal Description, Discovery, and Integration
Enables businesses to publish and discover
information about who provides what services
Specification for distributed Web service
registries: white pages, yellow pages, and
green pages
Builds on HTTP, XML, and SOAP
For more information, read:
http://msdn.microsoft.com/library/en-us/dnexxml/html/xml12182000.asp
http://www.uddi.org/about.html
10. 10
ASP.NET Web Service
Leveraging existing ASP developers
Easy to build, deploy, and administer as a
Web application
File extension is .asmx
End point is represented by URL
11. 11
Creating a Web Service
Open Microsoft Visual Studio® .NET
Select the language
Select the project type: ASP.NET Web Service
12. 12
Creating a Web Service
.asmx and .asmx.cs
Web.config
Global.asax
13. 13
Creating a Web Service
Inside Service.asmx
<%@ WebService Language="C#"
CodeBehind="~/App_Code/Service.cs"
Class="Service" %>
14. 14
Creating a Web Service
Inside Service1.asmx.cs
Add WebService attribute’s Namespace
property
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment
the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
}
19. 19
Creating a Consume web service
Client code
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
localhost.Service sr = new localhost.Service();
Response.Write(sr.HelloWorld());
}
}
21. 21
Summary
What is a Web service?
Technologies used
XML, SOAP, WSDL, DISCO, and UDDI
Walkthrough of creating a Web service
Walkthrough of creating a Web service client
Start building Web services today!
22. 22
References
Programming the Web with XML Web
services
Visual Studio .NET Help
ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/vxconProgrammableWebServices.htm
XML and SOAP Serialization
Visual Studio .NET Help
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconserialization.htm
Web Services Community
Go to http://msdn.microsoft.com/newsgroups/managed/default.asp
On left frame, drill down to
.NET Development > Framework > dotnet.framework.aspnet.webservices