the soap story -...

41
The SOAP Story Martin Parry Developer & Platform Group Microsoft Ltd [email protected] http://martinparry.com

Upload: duongdiep

Post on 23-Apr-2018

217 views

Category:

Documents


2 download

TRANSCRIPT

The SOAP Story

Martin Parry

Developer & Platform Group

Microsoft Ltd

[email protected]

http://martinparry.com

Agenda

Definitions

SOAP through the ages

SOAP and “standards”

Approaches to building and using services

SOAP Services with WCF

Services and the Workflow Foundation

Definitions

SOAP

Initially: Simple Object Access Protocol

It’s about services that exchange messages

The messages are formed from XML

Each message has headers plus a body

WSDL

Describes services and their operations

Uses XML and schema to describe messages

SOAP on the Microsoft Platform

SOAP Toolkit

NT4, Windows 2000

IIS4 or IIS5

Based around COM

Used ISAPI filter

No longer in mainstream support

Extended support expires in March 2008

SOAP on the Microsoft Platform

SOAP Toolkit

NT4, Windows 2000

IIS4 or IIS5

Based around COM

Used ISAPI filter

No longer in mainstream support

Extended support expires in March 2008

SOAP on the Microsoft Platform

SOAP Moniker

Introduced in Windows XP Professional

Scriptable mechanism for invoking web services

Example vbscript...

Dim proxy

Set proxy = GetObject(“soap:wsdl=http://....”)

SOAP on the Microsoft Platform

.NET Remoting

Supports TCP and HTTP transports

Can use IIS, or not

Supports SOAP formatting, or binary

Significant difference: -

– Distributed Object programming paradigm

– As opposed to message passing

SOAP on the Microsoft Platform

ASP.NET

.asmx web services

“add web reference”

Still relies on IIS

Support in v2.0 for WS-I Basic Profile

No other “standards” support is built-in

SOAP on the Microsoft Platform

Web Services Enhancements

Now in v3.0

Adds support for some WS-* protocols

Allows non-IIS services

Allows non-HTTP transport

SOAP on the Microsoft Platform

Windows Communication Foundation

Introduced in .NET FX 3.0

Entirely new communications API

Allows for changes in transports and protocols

Very extensible

Can use IIS, or not

Can use HTTP, or not

– Ships with named pipes, TCP, MSMQ, P2P

“Standards”

WS-SecurityMessage-level security

WS-SecureConversationOptimisation for WS-Security

WS-PolicyContractual info not contained in WSDL

WS-SecurityPolicyPolicy rules that are specific to security

WS-TrustDefines STS

Approaches – Distributed Objects

A long history on the Microsoft platform

DCOM, .NET Remoting

Difficulty in managing object lifetimes

Wisdom of making network transparent?

Perhaps the developer needs to know?

Simple, OO paradigm – easy to code against

Approaches – Message Exchange

Probably still use a proxy class

How is message body formed?Serialized object graph, or

Application code emits XML content directly

SOAP is all about message exchange reallyJust a question of how this appears to the application developer

Different exchange patternsRequest/response, one-way, duplex, intermediaries

Approaches - SOA

There are multiple definitions of SOANot necessarily tied to web services

A service performs one standalone piece of the business process

Participates in message exchange

No notion of data + behaviour, as in OO

Should use contract + policy so that clients can be built correctly

Sometimes see “service brokers”

Interopwith otherplatforms

ASMX

Attribute-Based

Programming

Enterprise Services

WS-*ProtocolSupport

WSE

Message-Oriented

Programming

System.Messaging

ExtensibilityLocation transparency

.NET Remoting

Distributed Applications

Services pass messages described by a contract

Service may provide metadata, describing: -The contract

The policy applied to communication

“Client”Message

Message

“Service”

Metadata

Message (SOAP)

Headers: Addressing, Security, etc.

Body: Payload

What do I send?

Where do I send it?

How should I send it?

Contract

Address

Binding

Mechanics of Communication

“Service”“Client”

Transport?

Encoding?

Security?

Mechanics of Communication

“Service”“Client”

EndpointContractBindingAddress

EndpointContractBindingAddress

EndpointContractBindingAddress

Contracts[ServiceContract]

public interface INuggetAccess

{

[OperationContract]string[] GetTopics();

}

.NET Interface

<definitions>

<portType>

<operation name=“GetTopics”> …

</portType>

</definitions>

WSDL

svcutil.exe

“Service”“Client”

[ServiceContract]

public interface INuggetAccess

{

[OperationContract]string[] GetTopics();

}

public class NuggetAccessService :

INuggetAccess

{string[] GetTopics() { }

}

Implements

Consumes

request metadata (WSDL)

Richness of metadata

Service can advertise a lot of info to a client

WSDL

WS-Policy (security etc)

Can do so overHTTP

WS- MetadataExchange

Makes building “clients” a lot simpler

Service

Contracts

Endpoints

Contract Details

Message exchange might be: -One-way, Request/Response, Two-way (Duplex)

WCF also supports serialization models from .NET 2.0

System.Xml.XmlSerialization, System.Runtime.Serialization

[ServiceContract]

public interface INuggetAccess {

[OperationContract]

List<TopicInfo> GetTopics();

}

Service

[DataContract(Namespace=…)]

public class TopicInfo {

[DataMember]

public int Id

}

Data

[MessageContract]

public class TypedMessage {

[MessageBody]

[MessageHeader]

}

Message

Hosting Servicespublic class Service :

INuggetAccess

{string[] GetTopics() { }

}

IIS

<%@ ServiceHost Service=“Service" %>

NuggetAccessService.svc

MyApp.exe

ServiceHost host =

new ServiceHost();

host.Open();

References

ServiceHost is the key class for hostingNeeds manual steps in your host application

Automatically done by IIS when provided with a .svc file

IIS handles additional transports in v7.0

Windows Communication Foundation

Client

WCF – sketched architecture

Binding(ordered list of channel types & config)

channel type N

channel type 2

channel type 1config

config

config

Your code

Service

Your code

Met

adat

a

objects XML

formatting

channel

channel

channel

Transport Channel (HTTP, TCP, MSMQ, Pipes, Peer)

channel

channel

channel

decodingencoding

behaviours behaviours

Standard Framework BindingsPre-built set in the framework

WS-I Basic Profile

WS-* on HTTP

TCP

Named Pipes

MSMQ

Peer

Configure/code your own as a "custom" binding

Binding

Transactions

Reliability

Security

channels

Configuration

Configuration

Configuration

Transport

Configuration

Instancing, Concurrency, Sessions

Service classes can be instantiated: -

Singleton, Per-Call, Per-Session, Shareable

Service code can be either: -

Single threaded, Re-entrant or Multi-threaded

Client

Service

Singleton

Message B

Message C

Message A

Instancing, Concurrency, Sessions

Service classes can be instantiated: -

Singleton, Per-Call, Per-Session, Shareable

Service code can be either: -

Single threaded, Re-entrant or Multi-threaded

Client

Service

Single Call

Single Call

Single Call

Message B

Message C

Message A

Instancing, Concurrency, Sessions

Service classes can be instantiated: -

Singleton, Per-Call, Per-Session, Shareable

Service code can be either: -

Single threaded, Re-entrant or Multi-threaded

Client

Service

Per Session

Message B

Message Asession

Per SessionMessage C

Security in WCF – Out of the box

Transport Level

HTTPS

IIS authentication modes

Message Level

UserName, X.509 Certificate, Windows

IssuedToken – that is, federated security

ASP.NET membership and role providers

Security in WCF - Extensibility

Roll your own

Username validator

Token validator

Credential types

Security Token Service

SAML claims

Etc...

Federated Security with WCF

WCF in .NET FX 3.5

Most of the new stuff isn’t SOAP

We’ll see some of that in the next session

Client proxies and partial trust environments

Durable services

Coming together with Workflow

Partial Trust

Now possible to call through WCF proxies in a partial trust environment

Various caveatsTransport is HTTP only, Security is HTTPS only

Encodings is all except MTOM

Bindings are BasicHttpBinding, WsHttpBinding, WebHttpBinding*

Other limitations– No Reliable Messaging, Transactions, Secure Conversation

Durable Services

Provider-based framework for easily adding long-running abilities to WCF services

client

Host (e.g. IIS)

implementation

stateresponse + token

initial call

serialize and store

state

token

Durable Services

Provider-based framework for easily adding long-running abilities to WCF services

client

Host (e.g. IIS)

implementation

state

second call + token

load and deserialize

state

token

Workflow

WF is not strictly about services, or SOAP

In .NET FX 3.5, WF has some WCF integration

A workflow can consume services

We can implement a service as a workflow

Services with WF

Summary

The Microsoft platform has evolved along with SOAP and its accompanying standards

Culminating in WCF

The most flexible, extensible communications stack we’ve ever produced

MSDN in the UK

Visit http://msdn.co.ukNewsletter

Events

Screencasts

Blogs

© 2007 Microsoft Ltd. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market

conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.

MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.