+ All Categories
Home > Documents > XML Web Services in Visual Studio.NET Peter Ty Developer Evangelist.NET and Developer Group.

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

Date post: 26-Dec-2015
Category:
Upload: geoffrey-richards
View: 228 times
Download: 0 times
Share this document with a friend
Popular Tags:
39
XML Web Services in Visual Studio.NET Peter Ty Peter Ty Developer Evangelist Developer Evangelist .NET and Developer Group .NET and Developer Group
Transcript

XML Web Services in Visual Studio.NET

Peter TyPeter Ty

Developer EvangelistDeveloper Evangelist

.NET and Developer Group.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

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

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

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

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

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

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

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

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

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 !!

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

……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 !!

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

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 !!

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…

……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 !!

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 !!

More Web Services demo!More Web Services demo!

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

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

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

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

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

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

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

Hardcore Web ServicesHardcore Web Services

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

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

Questions And AnswersQuestions And Answers


Recommended