bespoke digital media - web

Post on 08-May-2015

94 Views

Category:

Internet

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

Introduction to Web Services Introduction to Web Services

Bespoke Digital Media India Pvt. Ltd

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

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

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)

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

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/

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

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

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

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

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

12

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

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" %>

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

15

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

Compile the Web service & runningCompile the Web service & running

16

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

17

Creating a Consume web serviceCreating a Consume web service

Add Web reference Add Web reference

18

Creating a Consume web serviceCreating a Consume web service

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

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()); }}

20

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

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!

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

Thanks..Thanks..

23

top related