web services enhancements. 2 gxa global xml architecture global xml architecture variety of proposed...
Post on 18-Dec-2015
220 views
TRANSCRIPT
Web Services Web Services Enhancements Enhancements
22
GXAGXA
Global XML Architecture Global XML Architecture variety of proposed new standards in variety of proposed new standards in
the area of Web services interoperability the area of Web services interoperability A fair number of big corporate players A fair number of big corporate players
are cooperating behind the curtain of are cooperating behind the curtain of GXA, including Microsoft and IBM GXA, including Microsoft and IBM
33
Advanced WS protocolsAdvanced WS protocols
Designed to add common infrastructure Designed to add common infrastructure capabilities to basic WS stackcapabilities to basic WS stack
Built on existing foundation of XML, Built on existing foundation of XML, SOAP, XML Schema, and WSDLSOAP, XML Schema, and WSDL Uses standard extensibility pointsUses standard extensibility points
Protocols being standardized for Protocols being standardized for interopinterop
44
Protocol domainsProtocol domains
AdvancedAdvancedProtocolsProtocols
Internet TransportsInternet Transports
Sec
uri
tyS
ecu
rity
MessagingMessagingT
ran
sact
ion
sT
ran
sact
ion
s
Met
adat
aM
etad
ata
SOAP, XML, WSDLSOAP, XML, WSDLR
elia
ble
Rel
iab
leM
essa
gin
gM
essa
gin
g
55
WSE 1.0WSE 1.0
Simple framework layered on ASP.NET Simple framework layered on ASP.NET Web ServicesWeb Services
Support for…Support for… WS-SecurityWS-Security WS-Routing/ReferralWS-Routing/Referral WS-Attachments/DIMEWS-Attachments/DIME
66
WSE 2.0WSE 2.0
Extended security supportExtended security support WS-SecureConversation, WS-TrustWS-SecureConversation, WS-Trust Improved token managementImproved token management Protection from replay attacksProtection from replay attacks New WS-Policy supportNew WS-Policy support
Extended messaging supportExtended messaging support WS-Addressing supplants WS-RoutingWS-Addressing supplants WS-Routing
77
ASP.NET and WSEASP.NET and WSE
ASP.NET provides support for basic ASP.NET provides support for basic Web servicesWeb services Only the base-line protocolsOnly the base-line protocols Only RPC programming modelOnly RPC programming model
Web Services Enhancements (WSE) Web Services Enhancements (WSE) add-on provides advanced features on add-on provides advanced features on top of ASP.NETtop of ASP.NET Latest protocols, like WS-SecurityLatest protocols, like WS-Security A messaging programming modelA messaging programming model
88
How WSE worksHow WSE works
Core WSE functionality implemented as Core WSE functionality implemented as input and output filtersinput and output filters
ClientClient ServerServer
OutputOutputFiltersFilters
InputInputFiltersFilters
InputInputFiltersFilters
OutputOutputFiltersFilters
99
The PipelineThe Pipeline
Use of IO filters encapsulated by Use of IO filters encapsulated by pipeline classpipeline class
Pipeline can be extended with custom Pipeline can be extended with custom filtersfilters
Pipeline can be configured per-proxy or Pipeline can be configured per-proxy or per-processper-process
1010
PipelinePipeline
Web ServiceWeb Service
Server integrationServer integrationW
ebS
ervi
cesE
xten
sio
nW
ebS
ervi
cesE
xten
sio
n
Http-Http-ResponseResponse
Soap-Soap-ContextContext
Http-Http-ContextContext
Http-Http-RequestRequest
Soap-Soap-ContextContext
Inp
ut
Filt
erIn
pu
t F
ilter
Inp
ut
Filt
erIn
pu
t F
ilter
Inp
ut
Filt
erIn
pu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
HttpContext.CurrentHttpContext.Current
RequestSoapContext.CurrentRequestSoapContext.Current
ResponseSoapContext.CurrentResponseSoapContext.Current
1111
Server integrationServer integration
public class Service1 : WebServicepublic class Service1 : WebService{{ // WebServiceExtension runs gives pipeline a// WebServiceExtension runs gives pipeline a // chance to process messages // chance to process messages [WebMethod] [WebMethod] public String GetMessage()public String GetMessage() { { SoapContext reqCtx = RequestSoapContext.Current;SoapContext reqCtx = RequestSoapContext.Current; if (reqCtx == null)if (reqCtx == null) throw new ApplicationException("SOAP only!");throw new ApplicationException("SOAP only!"); DateTime created = reqCtx.Timestamp.Created;DateTime created = reqCtx.Timestamp.Created; return return c.Envelope.InnerXml;c.Envelope.InnerXml; }}}}
<%@ WebService class="Service1, SampDll" %><%@ WebService class="Service1, SampDll" %>
1212
Server configurationServer configuration WebServicesExtension must be WebServicesExtension must be
configured to process messagesconfigured to process messages(if not SoapContext == null)(if not SoapContext == null)
<configuration><configuration> <system.web><system.web> <webServices><webServices> <soapExtensionTypes><soapExtensionTypes> <add type="Microsoft.Web.Services.WebServicesExtension,<add type="Microsoft.Web.Services.WebServicesExtension, Microsoft.Web.Services,Version=2.0.0.0,Microsoft.Web.Services,Version=2.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35"Culture=neutral,PublicKeyToken=31bf3856ad364e35" priority="1" group="0"/>priority="1" group="0"/> </soapExtensionTypes></soapExtensionTypes> </webServices></webServices> </system.web></system.web> ......</configuration></configuration>
1313
Proxy integrationProxy integration
WebServicesClientProtocol is new WebServicesClientProtocol is new proxy base classproxy base class Output filters process request messagesOutput filters process request messages Input filters process response messagesInput filters process response messages
RequestSoapContext property exposes RequestSoapContext property exposes protocol settings for next message sentprotocol settings for next message sent
ResponseSoapContext property ResponseSoapContext property exposes protocol settings for last exposes protocol settings for last message receivedmessage received
1414
PipelinePipeline
ProxyClassProxyClass
Proxy integrationProxy integration
WebServices-WebServices-ClientProtocolClientProtocol
SoapWeb-SoapWeb-RequestRequest
SoapWeb-SoapWeb-ResponseResponse
SoapContextSoapContext
SoapContextSoapContext
RequestSoapContextRequestSoapContext
ResponseSoapContextResponseSoapContext
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Ou
tpu
t F
ilter
Inp
ut
Filt
erIn
pu
t F
ilter
Inp
ut
Filt
erIn
pu
t F
ilter
Inp
ut
Filt
erIn
pu
t F
ilter
1515
Proxy integrationProxy integration
static void Main()static void Main(){{ // create WebServicesClientProtocol-derived// create WebServicesClientProtocol-derived // proxy class // proxy class Service1Wse proxy = new Service1Wse();Service1Wse proxy = new Service1Wse();
// WebServiceClientProtocol gives pipeline// WebServiceClientProtocol gives pipeline // a chance to filter messages// a chance to filter messages Console.WriteLine(proxy.GetMessage()); Console.WriteLine(proxy.GetMessage()); }}
1616
FiltersFilters(Sender)(Sender)
1717
FiltersFilters(Receiver)(Receiver)
1818
WS-SecurityWS-Security
Defines a framework for building Defines a framework for building security protocols using existing security protocols using existing protocolsprotocols Propagation of security tokensPropagation of security tokens Integrity via XML SignatureIntegrity via XML Signature Confidentiality via XML EncryptionConfidentiality via XML Encryption
Framework designed for end-to-end Framework designed for end-to-end security of SOAP messagessecurity of SOAP messages From initial sender, through 0-n From initial sender, through 0-n
intermediaries to ultimate receiverintermediaries to ultimate receiver
1919
Simple Example (Server)Simple Example (Server)
[WebMethod][WebMethod]public string HelloWorld()public string HelloWorld(){{
string x="";string x="";SoapContext c=RequestSoapContext.Current;SoapContext c=RequestSoapContext.Current;foreach(SecurityToken s in c.Security.Tokens)foreach(SecurityToken s in c.Security.Tokens)
if(s is UsernameToken)if(s is UsernameToken)x=((UsernameToken)s).Password;x=((UsernameToken)s).Password;
if(x!="12345")if(x!="12345")throw new throw new
ApplicationException(“error");ApplicationException(“error");return "Hello World ";return "Hello World ";
}}
2020
Client Client
Service1Wse s=new Service1Wse();Service1Wse s=new Service1Wse();
s.RequestSoapContext.Security.Tokens.Add( s.RequestSoapContext.Security.Tokens.Add( new UsernameToken( "avi“ ,"12345“, new UsernameToken( "avi“ ,"12345“, PasswordOption.SendPlainText));PasswordOption.SendPlainText));
x=s.HelloWorld();x=s.HelloWorld();
2121
WSE 2.0 Messaging WSE 2.0 Messaging
WSE 2.0 provides a flexible API for WSE 2.0 provides a flexible API for sending and receiving SOAP messagessending and receiving SOAP messages in-processin-process TCPTCP HTTP HTTP
Basic functionality:Basic functionality: SoapSenderSoapSender SoapReceiver SoapReceiver
Higher-level API Higher-level API SoapClient and SoapService classes SoapClient and SoapService classes