Building Web Services with .NET

fizzlargeΑσφάλεια

3 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

63 εμφανίσεις

Building Web Services with .NET

Nigel Watson (
nigelwat@microsoft.com
)

Academic Developer Relations

Developer and Platform Strategy Group

Microsoft PTY, Melbourne

Agenda


Building the Programmable Web


Web Services in .NET


Furthering standards: GXA


Summary



.NET Vision

Bank

Airline

Ski Lodge

Ski Hire Gear

Building the Programmable Web

So… What is a Web Service?



A remote procedure call technology based on open
standards


A way to connect disparate applications on disparate
platforms using open standards


A way to automate application to application integration
using open standards


A way to expose application functionality using open
standards



OPEN STANDARDS ARE KEY TO WEB SERVICES


HTML

OS/Data

tier

Presentation

tier

BusLogic

tier

Web applications today...

The Web Services protocol stack

Founded on industry standard protocols


SOAP used to
call methods
on other
systems using XML over HTTP


WSDL used to describe a Web Service’s
interface

(i.e. methods available,
parameters, return values etc.)


UDDI is a directory that can be used to
programmatically search for a Web
Service


XML and HTTP

SOAP

Simple Object Access

Protocol

WSDL

Web Services

Description Language

UDDI

Universal Description,

Discovery and Integration

Industry Standard Protocols

(HTTP, XML, SOAP, WSDL, UDDI)

Richer, More

Productive User

Experience

Applications Leverage

Globally
-
Available

Federated Web Services

Applications Become

Programmable Web Services

Public Web

Services

.NET

Services

Internal

Services

Servers

Data, Hosts

Smarter

Clients

Smarter

Devices

Standard

Browsers

OS/Data

tier

Presentation

tier

BusLogic

tier

OS/Data

tier

BusLogic

tier

Presentation

tier

Other


Services

Next generation web applications…

Standards adherence is crucial

Web services will not reach their full potential without
vendor interoperability…


W3C


Committee overseeing the development and adoption of
Internet standards


WS
-
I


Industry initiative to promote vendor Web Services
interoperability


Over 150 participants, including Microsoft, IBM, Oracle,
SAP, Sun…


See
www.ws
-
i.org

for more information

OASIS


Involved in WS
-
Security standardisation process

From standards to implementation


.NET provides an
implementation

of the
Web Services technology stack.


Other vendors have similar libraries


IONA


Orbix E2A Web Services


IBM


WSTK for WebSphere (Now the ETTK)


BEA


Integrated into WebLogic 8.1 appserver


Open source/Freeware


AXIS (Apache)


Glue


Etc…


Agenda


Building the Programmable Web


.NET and Web Services


Furthering standards: GXA


Summary



.NET and Web Services


ASP.NET Architecture


Creating and consuming Web Services


Watching SOAP Messages


Adding meta
-
data to your Web Service


ASP.NET Web Services Architecture

IIS

O/S (W2K, XP, WS2K3)

ISAPI Ext

Common Language Runtime

ASP.NET Worker Process

ASP.NET Web Service

[WebMethod]

Public string blah()

{…}



Client Code



OS

Platform

SOAP Requests

SOAP Responses

ASP.NET


Server Side


To create a web service:


Create a new project in VS.NET


Add a Web Service class


Add methods to the class, decorate with
[WebMethod] attribute

[WebService]

Public Class Foo

{


[WebMethod]


public string Hello( string strName)


{ … }




}

ASP.NET


Client Side


To consume a web service:


Add a web reference to the web service to your
project


This adds a Web Service proxy class to your
project


Instantiate an instance of the proxy class and
begin calling methods on it.





localhost.Foo ws = new localhost.Foo();


string result = ws.Hello();




Demo


Create and Consume a
simple Web Service


demo

Drilling into SOAP Messages

<s:Envelope xmlns:s=“http://www.w3.org/2001/09/soap
-
envelope”>


<s:Header>


<c:alertcontrol xmlns:c=“http://example.org/alctl”>


<c:priority>1</c:priority>


<c:expires>2001
-
10
-
25T14:00:00</c:expires>


</c:alertcontrol>


</s:Header>


<s:Body>


<m:alert xmlns:m=“http://example.org/alert”>


<m:msg>Pick up Mary at school at 2pm</m:msg>



</m:alert>


</s:Body>

</s:Envelope>

Demo


Use proxyTrace to watch
SOAP messages


demo

Adding meta
-
data to your service


You can add useful information to your Web
Service’s browse page with attribute
parameters:


This information also appears in the Web
Service’s WSDL description

[WebService
(Description=“Foo Service”, NameSpace=“http…”)
]

Public Class Foo

{


[WebMethod
(Description=“Hello method”)
]


public string Hello( string strName)


{ … }




}

Demo


Adding meta
-
data to your
Web Service


demo

Agenda


Building the Programmable Web


Web Services in .NET


Furthering standards: GXA


Summary



There are still some gaps to fill…

End
-
to
-
end security including
authentication, authorization,
message integrity and encryption


Ability to dynamically configure message
routing paths for scalability and fault
tolerance


End
-
to
-
end guarantee of message
delivery with semantics (at
-
least
-
once, at
-
most
-
once, exactly
-
once)


Ability to transact across companies
and provide compensation
semantics

Security

Routing

Reliable

Messaging

Transactions

Directory

Inspection

Description

Referral

Routing

License

Security



Reliable Messaging

Transactions



Global XML Web Services
Architecture
-

GXA

GXA Design Principles


General
-
purpose


Agnostic to application domain


Standards
-
based


Multi
-
vendor interoperation critical


Federated


No central point of administration, control or
failure


Modular


Factored to stand alone or work together

General
-
Purpose


Universal communications


Across machine


Across process



Flexible communications


Extensible headers


Extensible body


Extensible communication
topology


Transport protocol neutral


Application category
neutral


Enterprise application
integration


Business
-
to
-
business


Business
-
to
-
consumer


Peer
-
to
-
peer



Platform neutral


Devices


Desktops


Clusters


Datacenters

Standards
-
Based


We are committed to…


Publishing GXA specifications


Working with partners to refine specifications


Working with partners, customers, and
standards bodies for broad adoption


WS
-
Security submitted to OASIS


WS
-
I likely to profile security and other
functionality

Federated


Fully distributed


Builds upon DNS and IP


Strong affinity towards hierarchical URI


Crosses organization and trust domains


Can be inspected by firewalls


Can interoperate with Kerberos and PKI


Does not require centralized servers

or administration

Modular


GXA framework layered on SOAP/WSDL
extensibility hooks


GXA surfaced as composable headers for
SOAP messages


GXA specifications are highly factored


Often coalesced as they evolve


GXA specifications are combined to provide
end
-
to
-
end capabilities


GXA protocols augment problem domain
-
specific protocols (e.g., banking)

Modular: Example

SOAP

Message

Security

Routing

<?xml version="1.0" encoding="utf
-
8"?>

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"


xmlns:xsd="http://www.w3.org/2001/XMLSchema"


xmlns:xsi="http://www.w3.org/2001/XMLSchema
-
instance">


<S:Header>


<m:path xmlns:m="http://schemas.xmlsoap.org/rp">


<m:action>http://tickers
-
r
-
us.org/getQuote</m:action>


<m:to>soap://tickers
-
r
-
us.org/stocks</m:to>


<m:from>mailto:johnsmith@isps
-
r
-
us.com</m:from>


<m:id>uuid:84b9f5d0
-
33fb
-
4a81
-
b02b
-
5b760641c1d6</m:id>


</m:path>


<wssec:Security


xmlns:wssec="http://schemas.xmlsoap.org/ws/2002/04/secext">


<wssec:BinarySecurityToken


ValueType="wssec:X509v3"


EncodingType=“wssec:Base64Binary">




dWJzY3JpYmVyLVBlc…..eFw0wMTEwMTAwMD


</wssec:BinarySecurityToken>


</wssec:Security>


</S:Header>


<S:Body>


<app:TrafficStatus


xmlns:app="http://highwaymon.org/payloads">


<road>520W</road><speed>3MPH</speed>


</app:TrafficStatus>


</S:Body>

</S:Envelope>

WS
-
Security
1.0


A specification for proposed SOAP
extensions to be used when building
secure Web services.


Supercedes the following specifications


SOAP
-
SEC


Microsoft’s WS
-
Security, WS
-
License


IBM’s security token and encryption


Dependent upon XML DIGSIG, XML
Encryption, XML Schema, SOAP…


Defined schema

WS
-
Security
1.0


Protection



Integrity = XML Signature + Security Tokens


Confidentiality = XML Encryption + Security
Tokens

Non
-
Goals of WS
-
Security


Establishing a security context that
requires multiple exchanges


Key exchange and derived keys


How trust is established


Policy Enforcement


Provisioning of certificates


XKMS

WS
-
Security
1.0



We have some more work to do…

SOAP


WS
-
Security


WS
-
Policy


WS
-
Trust


WS
-
Federation

WS
-
Privacy


WS
-
Authorization

WS
-
Secure
Conversation

Refer to Security Roadmap


http://msdn.microsoft.com/webservices

Today

Summary


Reviewed Web Services protocol stack


Looked at how you can leverage Web
Services from .Net


Looked briefly at how web services will
evolve over time



Further information


http://msdn.microsoft.com


http://gotdotnet.com


Developmentor mailing list


MSDN Updates (monthly)


http://msdn.microsoft.com/flash


Melbourne .NET User’s Group
(
http://www.mdnug.org)


Australian Developers.NETwork
(http://www.ausdev.net)

© 2001 Microsoft Corporation. All rights reserved.