39
XML Web Services in Visual Studio.NET Peter Ty Peter Ty Developer Evangelist Developer Evangelist .NET and Developer Group .NET and Developer Group

XML Web Services in Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

  • Upload
    ismet

  • View
    28

  • Download
    0

Embed Size (px)

DESCRIPTION

XML Web Services in Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group. Agenda. Web Service Infrastructure Web Services in Visual Studio .NET Hardcore Web Services. Agenda. Web Service Infrastructure Web Services in Visual Studio .NET Hardcore Web Services. ASMX. - PowerPoint PPT Presentation

Citation preview

Page 1: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

XML Web Services in Visual Studio.NET

Peter TyPeter Ty

Developer EvangelistDeveloper Evangelist

.NET and Developer Group.NET and Developer Group

Page 2: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

AgendaAgenda Web Service InfrastructureWeb Service Infrastructure Web Services in Visual Studio .NETWeb Services in Visual Studio .NET Hardcore Web ServicesHardcore Web Services

Page 3: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

AgendaAgenda Web Service InfrastructureWeb Service Infrastructure Web Services in Visual Studio .NETWeb Services in Visual Studio .NET Hardcore Web ServicesHardcore Web Services

Page 4: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Web Service (ASMX in ASP .NET)Web Service (ASMX in ASP .NET)Invoke Web Service methodsInvoke Web Service methods

Web Service InfrastructureWeb Service InfrastructureWhat makes a Web Service?What makes a Web Service?

ASMXASMX

Page 5: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

ASMXASMX

Web Service (ASMX in ASP.NET)– Invoke Web Service methods

Web Service Description Language (WSDL)– Describe Web Services– Describes dependencies (e.g., DataSets / XSD)

Web Service InfrastructureWeb Service InfrastructureWhat makes a Web Service?What makes a Web Service?

XSDXSDWSDLWSDL

Page 6: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Web Service (ASMX in ASP.NET)– Invoke Web Service methods

Web Service Description Language (WSDL)– Describe Web Services– Describes dependencies (e.g., DataSets / XSD)

Discovery Documents (DISCO)– Publish Web Services

Web Service InfrastructureWeb Service InfrastructureWhat makes a Web Service?What makes a Web Service?

ASMXASMX

XSDXSDWSDLWSDL

WSDLWSDLDISCODISCO

Page 7: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Web Service (ASMX in ASP.NET)– Invoke Web Service methods

Web Service Description Language (WSDL)– Describe Web Services– Describes dependencies (e.g., DataSets / XSD)

Discovery Documents (DISCO)– Publish Web Services

• UDDI

Web Service InfrastructureWeb Service InfrastructureWhat makes a Web Service?What makes a Web Service?

ASMXASMX

XSDXSDWSDLWSDL

WSDLWSDLDISCODISCO

DISCODISCOUDDIUDDI

Page 8: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Web Service InfrastructureWeb Service InfrastructureProtocolsProtocols

Basic: HTTP Get and HTTP PostBasic: HTTP Get and HTTP PostPrimitives (integers, strings, etc)Primitives (integers, strings, etc)Arrays of primitivesArrays of primitives

Default: Simple Object Access Default: Simple Object Access Protocol (SOAP)Protocol (SOAP)StructuresStructuresEnumerationsEnumerationsClassesClassesXML DataSetsXML DataSetsArrays of anythingArrays of anything

Page 9: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

AgendaAgenda Web Service InfrastructureWeb Service Infrastructure Web Services in Visual Studio .NETWeb Services in Visual Studio .NET Hardcore Web ServicesHardcore Web Services

Page 10: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Web Services in Visual Studio .NETWeb Services in Visual Studio .NETToolsTools On the Server SideOn the Server Side

Generates WSDLGenerates WSDL Generates .vsdiscoGenerates .vsdisco Generates HTML text pageGenerates HTML text page Supports breakpoints, tracing, etc.Supports breakpoints, tracing, etc.

On the Client SideOn the Client Side Generates proxy class with sync and Generates proxy class with sync and

async callsasync calls Supports “Step-Into” across web service Supports “Step-Into” across web service

callcall

Page 11: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Build Your First Web Build Your First Web ServiceService

Define a visionDefine a vision Brainstorming ideasBrainstorming ideas Set Deliverables (what to expose)Set Deliverables (what to expose) Imagine how much people will love itImagine how much people will love it

Let’s build it !!Let’s build it !!

Page 12: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Two Quick Steps to your Two Quick Steps to your first Web Servicefirst Web Service

Step 1. Create a project Step 1. Create a project Choose your favorite programming languageChoose your favorite programming language Choose the web service project typeChoose the web service project type Give it a NameGive it a Name

Page 13: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 14: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

……Two Quick Steps to your Two Quick Steps to your first Web Servicefirst Web Service

Step 2. Add a Web Service to the ProjectStep 2. Add a Web Service to the Project Name the Web ServiceName the Web Service Code a FunctionCode a Function Add an attribute keyword <WebMethod()> to Add an attribute keyword <WebMethod()> to

turn that function into a Web Service method turn that function into a Web Service method !!!!

That’s it !!That’s it !!

Page 15: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 16: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 17: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 18: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Build Web Services using Build Web Services using Visual Studio.NETVisual Studio.NET

Expose functionality as serviceExpose functionality as service No need to learn XMLNo need to learn XML Interface is automatically generatedInterface is automatically generated Seamless deployment Seamless deployment

Reuse existing Web ServicesReuse existing Web Services VS.NET generates the plumbingVS.NET generates the plumbing Full IntelliSense supportFull IntelliSense support

Build and consume with any VS languageBuild and consume with any VS language

Page 19: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Build Your Web Service Build Your Web Service ClientsClients

Web based (Browser) or Windows BasedWeb based (Browser) or Windows Based Unified programming modelUnified programming model Just Drag and Drop and a little codeJust Drag and Drop and a little code Imagine how you will love itImagine how you will love it

Let’s build it !!Let’s build it !!

Page 20: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Three Quick Steps to your Three Quick Steps to your first Web Service Clientfirst Web Service Client

Step 1. Create a project Step 1. Create a project Choose your favorite programming languageChoose your favorite programming language Choose the correct project type (ASP.NET web Choose the correct project type (ASP.NET web

applications)applications) Give it a NameGive it a Name

Step 2. Add a Web Reference to the Step 2. Add a Web Reference to the ProjectProject Locating a web serviceLocating a web service Add the reference for the target web serviceAdd the reference for the target web service

And…And…

Page 21: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 22: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

……Quick Steps to your first Quick Steps to your first Web Service ClientWeb Service Client

Step 3. Drag and Drop your way to a web Step 3. Drag and Drop your way to a web form client (plus a little coding…)form client (plus a little coding…) Use the tool box and drag and drop Use the tool box and drag and drop

elements to the formelements to the form Click on a control (a button usually) to open Click on a control (a button usually) to open

the code behind page the code behind page Implement any code to take action (call the Implement any code to take action (call the

web service!!)web service!!)

That’s it !!That’s it !!

Page 23: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 24: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 25: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Test that Web Service Test that Web Service ClientClient

Run Solution Build Run Solution Build Right click the aspx page and choose to Right click the aspx page and choose to

view in browserview in browser Test out the web service through this Test out the web service through this

web client you built !!web client you built !!

Page 26: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group
Page 27: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

More Web Services demo!More Web Services demo!

Page 28: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

AgendaAgenda Web Service InfrastructureWeb Service Infrastructure Web Services in Visual Studio .NETWeb Services in Visual Studio .NET Hardcore Web ServicesHardcore Web Services

Page 29: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Hard Core Web ServicesHard Core Web ServicesASP .NET IntrinsicsASP .NET Intrinsics

RequestRequest Server Variables (Host Address, Host Name)Server Variables (Host Address, Host Name) CookiesCookies Security (Client Certificate, Authentication, Encryption)Security (Client Certificate, Authentication, Encryption)

UserUser IdentityIdentity RoleRole

Session and ApplicationSession and Application StateState

ResponseResponse CookiesCookies

CacheCache

Page 30: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Hard Core Web ServicesHard Core Web ServicesSecuritySecurity Basic, Digest, Passport, Kerberos, and Basic, Digest, Passport, Kerberos, and

Windows authenticationWindows authentication ““Roll your own” authenticationRoll your own” authentication HTTPS / SSL encryptionHTTPS / SSL encryption Supports many business modelsSupports many business models

Secure ecommerce transactionsSecure ecommerce transactionsPay per usePay per useSubscriptionSubscription

Page 31: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Hard Core Web ServicesHard Core Web ServicesAsynchronous CallsAsynchronous Calls Synchronous Programming ModelSynchronous Programming Model

Foo(Param1, Param2) As StringFoo(Param1, Param2) As String

Asynchronous Programming ModelAsynchronous Programming ModelBeginFoo(Param1, Param2, Callback)BeginFoo(Param1, Param2, Callback)Callback(AsyncResult)Callback(AsyncResult)EndFoo(AsyncResult) As StringEndFoo(AsyncResult) As String

Page 32: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Hard Core Web ServicesHard Core Web ServicesSOAP Headers - ServerSOAP Headers - Server Make a Class That Inherits SoapHeaderMake a Class That Inherits SoapHeader Add Custom PropertiesAdd Custom Properties Associate This With Your Web ServiceAssociate This With Your Web Service

Public Class MyHeader : Inherits SoapHeaderPublic Class MyHeader : Inherits SoapHeader

Public Username As StringPublic Username As String

Public Password As StringPublic Password As String

End ClassEnd Class

Page 33: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Hard Core Web ServicesHard Core Web ServicesSOAP Headers - ClientSOAP Headers - Client Create Instance of the Header ClassCreate Instance of the Header Class Populate With ValuesPopulate With Values Attach To Web Service ObjectAttach To Web Service Object Call MethodCall Method

WebServ ws = new WebServ();WebServ ws = new WebServ();

MyHeader a = new MyHeader();MyHeader a = new MyHeader();

a.Username = "admin";a.Username = "admin";

a.Password = "password";a.Password = "password";

ws.MyHeader = a;ws.MyHeader = a;

ws.DoSomething();ws.DoSomething();

Page 34: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Hard Core Web ServicesHard Core Web ServicesSoapExtensionSoapExtension Used for More Advanced FunctionalityUsed for More Advanced Functionality Intercept Calls to a Web ServiceIntercept Calls to a Web Service Pre and Post ProcessingPre and Post Processing

Page 35: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Hardcore Web ServicesHardcore Web Services

Page 36: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Session SummarySession Summary

Web Services Are The Building Blocks Web Services Are The Building Blocks For The Next Generation Of The InternetFor The Next Generation Of The Internet

Gives Client Access to any kind of DataGives Client Access to any kind of Data Make Business-to-Business EasyMake Business-to-Business Easy Visual Studio .NET Provides Great Visual Studio .NET Provides Great

ToolsTools

Page 37: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

ResourcesResources MSDN Web site at MSDN Web site at

msdn.microsoft.commsdn.microsoft.com

External SitesExternal Sites www.gotdotnet.comwww.gotdotnet.com

Looking for ideas?: Web Service Looking for ideas?: Web Service Search EngineSearch Engine http://www.salcentral.com/salnet/webservihttp://www.salcentral.com/salnet/webservi

ceswsdl.aspceswsdl.asp

Page 38: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group

Questions And AnswersQuestions And Answers

Page 39: XML Web Services in  Visual Studio.NET Peter Ty Developer Evangelist .NET and Developer Group