23
Introduction to Web Introduction to Web Services Services Bespoke Digital Media India Pvt. Ltd

Bespoke Digital Media - Web

Embed Size (px)

DESCRIPTION

Bespoke Digital Media, a UK based digital agency provides web and software services.

Citation preview

Page 1: Bespoke Digital Media - Web

Introduction to Web Services Introduction to Web Services

Bespoke Digital Media India Pvt. Ltd

Page 2: Bespoke Digital Media - Web

2

AgendaAgenda

What is a Web service?What is a Web service? Technologies usedTechnologies used XML, SOAP, WSDL, DISCO, and UDDIXML, SOAP, WSDL, DISCO, and UDDI Walkthrough creating a Web serviceWalkthrough creating a Web service Walkthrough creating a Web service clientWalkthrough creating a Web service client ReferencesReferences Q&AQ&A

Page 3: Bespoke Digital Media - Web

3

What is a Web Service?What is a Web Service? A programmable application component that A programmable application component that

is accessible via standard Internet protocolsis accessible via standard Internet protocols Web page with functionsWeb page with functions Available for a variety of clientsAvailable for a variety of clients Examples: stock quotes, traffic conditions, Examples: stock quotes, traffic conditions,

calculators, news, weather, et ceteracalculators, news, weather, et cetera

Page 4: Bespoke Digital Media - Web

4

Technologies UsedTechnologies Used Standard way to Standard way to represent datarepresent data

XML (and XML schemas)XML (and XML schemas)

Common, extensible Common, extensible message formatmessage format SOAPSOAP

Common, extensible Common, extensible contract languagecontract language Web Services Description Language (WSDL)Web Services Description Language (WSDL)

Way to Way to discover site servicesdiscover site services DiscoDisco

Way to Way to discover service providersdiscover service providers Universal Description, Discovery, and Integration (UDDI)Universal Description, Discovery, and Integration (UDDI)

Page 5: Bespoke Digital Media - Web

5

XMLXML EExxtensible tensible MMarkup arkup LLanguageanguage Language for describing documents with Language for describing documents with

structured datastructured data Industry standardIndustry standard XML Schemas – XSDXML Schemas – XSD

XML basedXML based Language for describing data typesLanguage for describing data types

For more information, read:For more information, read:http://msdn.microsoft.com/library/en-us/dnwebsrv/html/http://msdn.microsoft.com/library/en-us/dnwebsrv/html/

xmloverchap2.aspxmloverchap2.asp

Page 6: Bespoke Digital Media - Web

6

SOAPSOAP

A simple, XML-based protocol for exchanging A simple, XML-based protocol for exchanging structured and type information on the Web structured and type information on the Web

Industry standardIndustry standard Lightweight and XML-based protocolLightweight and XML-based protocol Can support different protocols and formats: Can support different protocols and formats:

HTTP, SMTP, and MIMEHTTP, SMTP, and MIME SOAP messageSOAP message For more information, read:For more information, read:

http://msdn.microsoft.com/soap/http://msdn.microsoft.com/soap/

Page 7: Bespoke Digital Media - Web

7

WSDLWSDL It is an XML document describing Web It is an XML document describing Web

servicesservices Define data types (XSD)Define data types (XSD) Define messages in terms of typesDefine messages in terms of types Define bindings to transport protocol, message Define bindings to transport protocol, message

formatformat SOAP 1.1, HTTP Get/Post, MIMESOAP 1.1, HTTP Get/Post, MIME

Define services as collections of portsDefine services as collections of ports

WSDL.exeWSDL.exe For more information read:For more information read:

http://msdn.microsoft.com/library/en-us/dnwebsrv/html/wsdlexplained.asphttp://msdn.microsoft.com/library/en-us/dnwebsrv/html/wsdlexplained.asp

Page 8: Bespoke Digital Media - Web

8

DISCODISCO

Document DiscoveryDocument Discovery A client finds a particular Web services by A client finds a particular Web services by

discoverydiscovery Document discovering services at a Document discovering services at a

particular URLparticular URL Document is in XML formatDocument is in XML format Document has .disco and .vsdisco Document has .disco and .vsdisco

extensionsextensions Disco.exeDisco.exe

Page 9: Bespoke Digital Media - Web

9

UDDIUDDI UUniversal niversal DDescription, escription, DDiscovery, and iscovery, and IIntegrationntegration Enables businesses to publish and discover Enables businesses to publish and discover

information about who provides what servicesinformation about who provides what services Specification for distributed Web service Specification for distributed Web service

registries: registries: white pages, yellow pages, and white pages, yellow pages, and green pagesgreen pages

Builds on HTTP, XML, and SOAPBuilds on HTTP, XML, and SOAP For more information, read:For more information, read: http://msdn.microsoft.com/library/en-us/dnexxml/html/xml12182000.asp

http://www.uddi.org/about.html

Page 10: Bespoke Digital Media - Web

10

ASP.NET Web ServiceASP.NET Web Service

Leveraging existing ASP developersLeveraging existing ASP developers Easy to build, deploy, and administer as a Easy to build, deploy, and administer as a

Web applicationWeb application File extension is .asmxFile extension is .asmx End point is represented by URLEnd point is represented by URL

Page 11: Bespoke Digital Media - Web

11

Creating a Web ServiceCreating a Web Service Open Microsoft Visual StudioOpen Microsoft Visual Studio®® .NET .NET Select the languageSelect the language Select the project type: ASP.NET Web ServiceSelect the project type: ASP.NET Web Service

Page 12: Bespoke Digital Media - Web

12

Creating a Web ServiceCreating a Web Service .asmx and .asmx.cs.asmx and .asmx.cs Web.configWeb.config Global.asaxGlobal.asax

Page 13: Bespoke Digital Media - Web

13

Creating a Web ServiceCreating a Web Service

Inside Service.asmxInside Service.asmx

<%@ WebService Language="C#" <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" CodeBehind="~/App_Code/Service.cs" Class="Service" %>Class="Service" %>

Page 14: Bespoke Digital Media - Web

14

Creating a Web ServiceCreating a Web Service Inside Service1.asmx.csInside Service1.asmx.cs Add WebService attribute’s Namespace Add WebService attribute’s Namespace

property 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"; } }

Page 15: Bespoke Digital Media - Web

15

Creating a Web ServiceCreating a Web Service (5)(5)

Compile the Web service & runningCompile the Web service & running

Page 16: Bespoke Digital Media - Web

16

Creating a Consume web serviceCreating a Consume web service Create a Web Site with C#Create a Web Site with C#

Page 17: Bespoke Digital Media - Web

17

Creating a Consume web serviceCreating a Consume web service

Add Web reference Add Web reference

Page 18: Bespoke Digital Media - Web

18

Creating a Consume web serviceCreating a Consume web service

Proxy file is created: Proxy file is created: Reference.csReference.cs

Page 19: Bespoke Digital Media - Web

19

Creating a Consume web serviceCreating a Consume web service Client codeClient 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()); }}

Page 20: Bespoke Digital Media - Web

20

Creating a Consume web serviceCreating a Consume web service Run the Web service clientRun the Web service client

Page 21: Bespoke Digital Media - Web

21

SummarySummary

What is a Web service?What is a Web service? Technologies usedTechnologies used XML, SOAP, WSDL, DISCO, and UDDIXML, SOAP, WSDL, DISCO, and UDDI Walkthrough of creating a Web serviceWalkthrough of creating a Web service Walkthrough of creating a Web service clientWalkthrough of creating a Web service client

Start building Web services today!Start building Web services today!

Page 22: Bespoke Digital Media - Web

22

ReferencesReferences Programming the Web with XML Web Programming the Web with XML Web

services services Visual Studio .NET Help Visual Studio .NET Help

ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/vxconProgrammableWebServices.htmvxconProgrammableWebServices.htm

XML and SOAP SerializationXML and SOAP SerializationVisual Studio .NET HelpVisual Studio .NET Help

ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconserialization.htmms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconserialization.htm

Web Services CommunityWeb Services Community Go to Go to http://msdn.microsoft.com/newsgroups/managed/default.asp

On left frame, drill down toOn left frame, drill down to

.NET Development > Framework > .NET Development > Framework > dotnet.framework.aspnet.webservicesdotnet.framework.aspnet.webservices

Page 23: Bespoke Digital Media - Web

Thanks..Thanks..

23