Descargar la presentación
La descarga está en progreso. Por favor, espere
Publicada porCarmelo Cerro Modificado hace 11 años
1
Essential Web Services : Programando con .NET y WSE 2.0
Eduardo Mangarelli Gabriel Cor TechEd 2002
2
Agenda Arquitecturas Orientadas a Servicios ASMX WebMethods
WSE 2.0 Básico Características principales de WSE 2.0 API de Mensajería de WSE 2.0 TechEd 2002
3
Como era antes Machine A IDL Machine B NDR RPC (TCP)
3 Machine A IDL Machine B RPC 2 request NDR IDL proxy IDL stub response RPC (TCP) Registry Registry 1 4 discovers machine B 1 2 Communications protocol Message format Description language 3 Discovery mechanism 4 TechEd 2002
4
Sin estándares ni interop
Tecnologías de objetos diferían en muchas maneras Interoperabilidad muy compleja Encierra a los clientes en la misma tecnología DCOM CORBA Java RMI RPC Protocol RPC IIOP IIOP or JRMP Message Format NDR CDR Java Ser. Format Description IDL OMG IDL Java Discovery Windows Registry Naming Service RMI Registry or JNDI TechEd 2002
5
Hacia adelante Los desarrolladores están cansados de estar atados a una tecnología La clave es diseñar una arquitectura que no tenga pre-supuestos acerca de … Plataforma Lenguaje Objetos RPC Service Oriented Architecture (SOA) TechEd 2002
6
El nuevo mundo de SOA SOA requiere una visión diferente del mundo
Servicios autónomos Fronteras explícitas, asumir heterogeneidad Integración basada en formatos de mensaje XML (compartir esquemas, no clases) Compatibilidad basada en políticas TechEd 2002
7
Web Services Las tecnologías de invocaciónremota (Web services/remoting) son los bloques de construcción de SOA Los Webservices representan una revolución basada en XML de tecnologías distribuidas Diseñados alrededor de la interoperatbilidad Protocolos de comunicación estándar Formatos de representación de datos estándar Lenguajes de descripción estándar Mecanismos de descubrimiento estándar TechEd 2002
8
Definición de Web Services
Una aplicación o servicio que… Se comunica por protocolos abiertos de Internet Procesa los mensajes XML empaquetados en SOAP Describe los mensajes usando un esquema XML Provee una descripción de su interfaz con WSDL Puede ser descubierto via UDDI TechEd 2002
9
Perfil básico de Web Services (WS-I)
UDDI Portable type system Mensajes serializados Empaquetado Descripción de Endpoint Registro de endpoints WSDL XSD SOAP XML Namespaces Wire protocols Detalles en ws-i.org Description languages Discovery mechanisms TechEd 2002
10
A la manera de WebServices
Machine A Machine B Web Service Invoke 2 request XML WSDL proxy WSDL stub response HTTP + SOAP 1 3 4 WSDL UDDI Server WSDL 1 2 Communications protocol Message format Description language 3 Discovery mechanism 4 WSDL WSDL TechEd 2002
11
A la manera WebServices
2 XML delayed notification SMTP + SOAP 1 Machine A Machine B Web Service Send XML Message one-way request 2 XML TCP + SOAP 1 3 WSDL 4 UDDI Server 1 2 Communications protocols Message format Description language 3 Discovery mechanism 4 WSDL WSDL WSDL TechEd 2002
12
Es el perfil básico suficiente?
El perfil básico (XSD, SOAP, WSDL, UDDI) permite una comunicación básica Intercambios XML Simples Entre fronteras heterogéneas y servicios autónomos Compartiendo esquemas que permiten abstracciones útiles La mayoría de las aplicaciones distribuidas necesitan más… TechEd 2002
13
Temas Necesarios Los Web Services tienen muchas necesidades en común
Modelo de seguridad orientado a mensaje Mensajería confiable Soporte a transacciones Mecanismos de direccionamiento/ruteo Mensajería asincrónica Metadata para políticas/capacidades Soporte a datos binarios TechEd 2002
14
Framework SOAP SOAP provee el framework para atacar estos temas
Distinción entre Header/Body permite extensiones <soap:Envelope xmlns:soap="..."> <soap:Header> </soap:Header> <soap:Body> </soap:Body> </soap:Envelope> <!-- standardized, pluggable headers --> <!-- payload --> TechEd 2002
15
Extendiendo SOAP SOAP por si mismo no define headers
Con Well-known headers las aplicaciones pueden negociar WS-* extiende SOAP con headers estándar Ahora se necesitan implementaciones TechEd 2002
16
Stack de protocolos WS-* k
Microsoft está trabajando de cerca con partners para desarrollar un protocolo completo de WS-* Ataca la mayoría de los temas vistos Construido sobre SOAP de una manera neutra al transporte Para ofrecer mensajes seguros, confiables y transaccionales TechEd 2002
17
Stack WS-* Applications & Application Infrastructure
Connected Applications Business Process … Management Security Reliability Transactions Metadata Foundation MS has worked closely with numerous partners including IBM, SAP, BEA, Verisign, RSA, and Tibco to deliver a complete protocol stack for secure reliable and transacted Web services. We have listened to our customers and have delivered the core set of protocols necessary for building Service Oriented Architectures. The strategy is to work w/ platform vendor's and subject matter experts to publish specifications that address the needs of each bucket accelerate broad adoption of these specifications and deliver a robust implementation of them. For example, in April 2002 we delivered a joint Security white paper with IBM and published the WS-Security specification w/ IBM and Verisign. To accelerate the broad adoption, after refining the specification, we submitted it to a technical OASIS w/ IBM, Verisign and 9 other vendors including Sun and Oracle and other security players, Entrust and RSA. In early Dec we released the first fully supported implementation of WS-Security in the Web Services Enhancement for Microsoft Visual Studio .NET v 1.0 (WSE). IBM, RSA, Verisign, TME and others all have production code supporting WS-Security. You can read about interoperability between different companies providing WS-Security implementations on the Microsoft Web services developer center. We plan on following a similar strategy w/ other specifications… Publish w/ subject matter experts and platform vendors, refine specifications with partners based on community feedback, accelerate broad industry adoption, and provide implementation. Transport Box (HTTP, TCP, UDP, SMTP, FTP, etc.) Web services need to be transport independent so that customers can choose what’s best for them. Web services enable the development of Service Oriented Architectures for use within and beyond the enterprise. XML Box Built on XML, SOAP and WSDL Has an extensible protocol framework, which has been used to create the additional capabilities in the Foundation. Has become lingua franca for interoperability across systems and trust boundaries XML, SOAP, and WSDL is supported in shipping products from Microsoft, IBM, Iona, BEA, Sun, Oracle, etc… Foundation Provides secure, reliable and transactional capabilities Wide support among vendors and customers Is complete Connected Apps Once the foundation is in place, people will begin building connected applications. Underlying some of these connected application, there will be a need for advanced business process management and management capabilities Reference Materials to better understand the architecture The WS-Security Roadmap protocols—In April 2002, IBM and Microsoft published a roadmap for Web service security [WS-Security Roadmap] that supports, integrates and unifies several popular security models, mechanisms, and technologies. Reliable Message Delivery in a Web Services World: A Proposed Architecture and Roadmap Infoset White Paper: This paper describes the importance of the XML infoset model. List of Specifications for Each Bucket XML Foundation XML - Extensible Markup Language is a subset of SGML. XML Schema - XML Schemas express shared vocabularies and allow machines to carry out rules made by people. They provide a means for defining the structure, content and semantics of XML documents. Description & Discovery UDDI - The UDDI (Universal Description, Discovery and Integration) contains standards-based specifications for service description and discovery. WSDL - Description of Web Services as individual messages. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. WS-Policy - Extensions to SOAP that describe a mechanism for requesting and communicating acceptable and required formats, elements, and message characteristics. WS-PolicyAssertions - This document specifies a set of common message policy assertions that can be specified within a policy. WS-PolicyAttachment - This document specifies three specific attachment mechanisms for using policy expressions with existing XML Web service technologies. Futures as published in the Reliable Message Delivery in a Web Services World: A Proposed Architecture and Roadmap WS-MetadataExchange the Represents a generalization of the PolicyExchange mechanisms to provide a web services based mechanism to also aquire WSDL, Schema, and other metadata. This replaces WS-PolicyExchange. Messaging SOAP Previous base standard for sending messages over various transports, including HTTP. SOAP Base standard for sending messages over various transports, including HTTP. Latest working group status. WS-Inspection - Site inspection of services. Merge of DISCO and IBM approaches. UPNP Version 2 Discovery Protocol - We propose defining UPNP v2 discovery as a Web Service protocol that is simple and well integrated into the rest of UPNP v2 architecture. WS-Addressing - WS-Addressing provides transport-neutral mechanisms to address Web services and messages. Replaces WS-Routing and subsumes half of the WS-Messaging spec. Security WS-Security Roadmap - Overview of Web Services Security. WS-Security Security - Protocol for secure communication with SOAP. WS-Security Appnotes - This paper is provided as guidance to implementers of the WS-Security [WSSEC] specification. WS-Security Addendum - This document describes clarifications, enhancements, best practices, and errata of the WS-Security specification. WS-Security Profile for XML-based Tokens - This document describes a general framework to enable XML-based security tokens to be used with WS-Security. Two profiles that use this general framework are provided: one for the Security Assertion Markup Language (SAML) and other for the the eXtensible rights Markup Language (XrML). WS-Trust - This specification defines extensions that build on WS-Security to request and issue security tokens and to manage trust relationships. WS-SecurityPolicy - This document is an addendum to WS-Security and indicates the policy assertions for WS-Policy which apply to WS-Security. WS-SecureConversation - This specification defines extensions that build on WS-Security to provide secure communication. Specifically, we define mechanisms for establishing and sharing security contexts, and deriving session keys from security contexts. Futures as published in the Security in a Web Services World: A Proposed Architecture and Roadmap, IBM and MS WS-Federation - This specification defines mechanisms that are used to enable identity, authentication, and authorization federation across different trust domains including access from Web browsers. WS-Privacy - Defines extensions that build on WS-Policy to declare privacy policies and privacy preferences/requirements; does not define a privacy policy; defines a framework that works with any privacy policy language. WS-Authorization - The WS-Authorization specification defines a format for describing authorization data that integrates with WS-Security and other security extensions. Reliable Messaging WS-ReliableMessaging - A messaging protocol for sending SOAP messages reliably in a bi-directional communication between endpoints. WS-ReliableMessaging Executive Summary - This roadmap provides an overview and top level specification details for Reliable Messaging. WS-TransmissionControl—A set of constructs for controlling the exchange of messages between services to improve reliability by preventing message loss due to service unavailability, overloading queues and other causes. WS-EndpointResolution—A set of Web service mechanisms that support selecting a specific endpoint for an operation or message from a set of allowed candidates. This is particularly useful in server farms and mobile environments. Transactions WS-Transaction - This specification describes coordination types that are used with the extensible coordination framework described in the WS-Coordination specification. WS-Coordination - This specification (WS-Coordination) describes an extensible framework for providing protocols that coordinate the actions of distributed applications. Business Processes BPEL4WS - A language for workflow management that can exploit the foundation laid by WS-Coordination and WS-Transaction. Messaging XML … HTTP TCP SMTP Transports TechEd 2002
18
WS-* Specifications (Resumen)
Messaging WS-Addressing WS-Eventing MTOM (Attachments) Reliability WS-ReliableMessaging Security WS-Security WS-Trust WS-SecureConversation WS-Federation Transactions WS-Coordination WS-AtomicTransaction WS-BusinessActivity Metadata WS-Policy WS-PolicyAssertions WS-PolicyAttachment WS-SecurityPolicy WS-Discovery WS-MetadataExchange Ver Especificación en MSDN TechEd 2002
19
Plataforma .NET de Web Services
ASMX es la plataforma actual de WS Soporta el perfil básico de servicios simples No implementa WS-* WSE 2.0 es una extensión Puede usarse para extender el comportamiento de ASMX Puede usarse sin ASMX Provee soporte a varias especificaciones WS-* Indigo es la próxima generación de WS Va a proveer una solución completa WS-* TechEd 2002
20
Resumen hasta ahora Un Web Sevice es accesible por protocolos estándar
XML es un formato de representación de datos SOAP es un framework XML para mensajería Los esquemas XML describen mensajes XML WSDL describe como invocar Web services UDDI es un repositorio de descripción de servicios WS-* extiende SOAP con headers estándar TechEd 2002
21
ASMX WebMethods TechEd 2002
22
WebMethods WebMethods mapea métodos a mensajes SOAP
Los métodos se calfiican con el atributo [WebMethod] Se encuentra en el namespace System.Web.Services Construido sobre HTTP y un stack XML Ofrece alta producctividad (solo hay que escribir los métodos) <WebMethod()> _ Public Function Add(ByVal n1 As Integer, ByVal n2 As Integer) As Integer Return n1 + n2 End Function TechEd 2002
23
Web Service Namespace Especifica el namespace XML en la clase
Usa el atributo [WebService] [WebService(Namespace=“ public class MathService { [WebMethod] public int Add(int n1, int n2) return n1 + n2; } TechEd 2002
24
Infraestructura del WebMethod
ASP.NET provee la infraestructura para procesar WebMethods La clase del WebMethod está “ligada” a un punto de entrada .asmx El manejador procesa los mensajes de entrada SOAP TechEd 2002
25
Un punto de entrdada .asmx
math.asmx WebService class="MathService"%> math.cs using System.Web.Services; public class MathService { [WebMethod] public int Add(int n1, int n2) return n1 + n2; } TechEd 2002
26
Instalando un WebMethod
Una vez implementada, la clase debe ser instalada El assembly de pone en el bin del directorio virtual o en el GAC El archivo .asmx se pone en el directorio virtual \inetpub \wwwroot \math math.asmx \bin math.dll Directorio virtual Subdirectorio bin TechEd 2002
27
.asmx y compilación JIT El archivo .asmx puede contener código del WebMethod Se compila JIT en la primera invocación language="C#" class="MathService"%> using System.Web.Services; public class MathService { [WebMethod] public int Add(int n1, int n2) return n1 + n2; } TechEd 2002
28
Funcionalidad WebMethod
El manejador .asmx del WebMethod provee cuatro áreas de funcionalidad Enviar los mensajes SOAP a los métodos CLR Serialización/deserialización de objetos Generación automática de documentación/WSDL Modelo de extensibilidad TechEd 2002
29
Method Dispatching POST /math/math.asmx HTTP/1.1
SOAPAction: "urn:math:Mul" <s:Envelope...> <s:Body> <x:Mul>... </s:Body> </s:Envelope> WebService language="C#" class="MathService" %> using System.Web.Services; public class MathService { [WebMethod] public int Add(int n1, int n2) { return n1 + n2; } public int Sub(int n1, int n2) { return n1 - n2; public int Mul(int n1, int n2) { return n1 * n2; ... .asmx handler IIS TechEd 2002
30
Serialización de objetos basada en XML
Los WebMethods mapean entre XML y los objetos Construido sobre el XmlSerializer Asegura que los objetos mapeen a XML y los tipos a XSD Garantiza la interoperabilidad con otras plataformas No maneja las complejidades de los modelos de objetos modernos… TechEd 2002
31
Deserialización WebMethod
<s:Envelope...> <s:Body> <x:Mul...> <n1>33.3</n1> <n2>66.6</n2> </x:Mul> </s:Body> </s:Envelope> WebService language="C#" class="MathService" %> using System.Web.Services; public class MathService { [WebMethod] public int Add(int n1, int n2) { return n1 + n2; } public int Sub(int n1, int n2) { return n1 - n2; public int Mul(int n1, int n2) { return n1 * n2; ... .asmx handler Deserialize n1 n2 System.Integer TechEd 2002
32
Usando tipos complejos
Los WebMethods pueden manejar la mayoría de los objetos Los objetos pueden ser usados como entrada/salida Los objetos mapean a objetos complejos XSD public class Point { public double x; public double y; } public class Geometry { [WebMethod] public double Distance(Point orig, Point dest) { // implementation omitted TechEd 2002
33
Ejemplo de tipo complejo
request <soap:Envelope xmlns:soap="..."> <soap:Body> <Distance xmlns="urn:geometry"> <orig> <x>0</x> <y>0</y> </orig> <dest> <x>3</x> <y>4</y> </dest> </Distance> </soap:Body> </soap:Envelope> response <soap:Envelope xmlns:soap="..."> <soap:Body> <DistanceResponse xmlns="urn:geometry"> <DistanceResult>5</DistanceResult> </DistanceResponse> </soap:Body> </soap:Envelope> TechEd 2002
34
Limitaciones No todos los tipos del CLR son serializables y pueden “romper” escenarios de interoperabilidad Grafos no jerárquicos Estructuras de datos genéricos (DataSet, Collection, etc.) Objetos polimórficos Si lo importante es la interoperabilidad, se debe simplificar TechEd 2002
35
WebMethods y Errores SOAP define como manejar errores
Elemento de falla SOAP en el Body del mensaje Código de estado 500 (“Internal Server Error”) HTTP El manejador .asmx traduce las excepciones a fallas Todas las excepciones del CLR se capturan por la infraestructura Se puede lanzar un SoapException para controlar los detalles TechEd 2002
36
Generando documentación/WSDL
El manejador .asmx genera la documentación Es retornada para los requests GET sin query string El manejador .asmx genera WSDL Se usa '?wsdl' en el query string (ej: math.asmx?wsdl) Los clientes pueden utilizar el WSDL para crear clases proxy TechEd 2002
37
WSDL y la generación de código
<wsdl:definitions ...> ... </wsdl:definitions> wsdl.exe /server wsdl.exe ?wsdl public abstract class MathService : WebService { ... } public class MathService : SoapHttpClientProtocol { ... } .asmx csc.exe service.dll TechEd 2002
38
Modelo de extensibilidad WebMethods
El manejador .asmx provee el modelo Permite pre/post procesamiento de mensajes SOAP Existen puntos de entrada disponibles antes/despues de la serialización/deserialización Conocido como el “SoapExtension framework” Machine B 1 deserialize stage Web Service SOAP Envelope 2 serialize stage TechEd 2002
39
Limitaciones WebMethod
Los WebMethods solo soportan el perfil básico de WS-I No las especificaciones adicionales WS-* Provee puntos de extensibilidad Los WebMethods solo soportan HTTP TechEd 2002
40
Resumen hasta ahora ASP.NET provee un framework de WebServices WS-I completo El manejador WebMethod (.asmx) provee toda la maquinaria HTTP/XML Envía los mensajes SOAP al CLR Los parámetros son “marshaleados” con la clase XmlSerializer Generación automática de documentación/WSDL Modelo de extensibilidad TechEd 2002
41
Introducción a WSE 2.0 TechEd 2002
42
La plataforma de la próxima generación
La plataforma de Web services debe evolucionar para cubrir las necesiades comunes (WS-*) Menajes seguros, confiables y transaccionales ¿Cómo extendemos ASMX para que lo haga? TechEd 2002
43
SoapExtension Framework
ASMX provee un framework de extensiones Se puede escribir una clase que será llamada Antes y después de cada mensaje SOAP Antes y después de cada punto de entrada a un WebMethod TechEd 2002
44
Etapas SoapExtension Las extensiones se llaman en cada etapa
ASMX Handler Web service class [WebMethod] public int add int x, int y) { return x+y; } <soap:Envelope … </soap:Envelope> XmlSerializer Extension called (1) Extension called (2) Extension called (3) Extension called (4) TechEd 2002
45
Clases SOAP Extension Una clase que derive de SoapExtension
public class ValidationExtension : SoapExtension { public override object GetInitializer(Type serviceType) { // class-wide static initialization } public override object GetInitializer( LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { // method-wide static initialization public override void Initialize(object initializer) { // per-instance initialization public override void ProcessMessage(SoapMessage message) { // perform pre/post-processing just before/after // message deserialization/serialization TechEd 2002
46
Configurando una SOAP Extension
Las clases de extensión pueden ser asociadas con cualquier WebMethod en una aplicación La clase se especifica en el web.config Se llama para cada WebMethod en una aplicació La clase puede ser asociada con un WebMethod específico El método se califica con un atributo personalizado que especifique la extensión La extensión se llama para ese WebMethod TechEd 2002
47
Configurando una SOAP Extension
Para todos los WebMethod <configuration> <system.web> <webServices> <soapExtensionTypes> <add type="ValidationExtension, ValidationTools" priority="1" group="0" /> </soapExtensionTypes> </webServices> </system.web> </configuration> TechEd 2002
48
WSE 2.0 Microsoft creo los Web Services Enhancements (WSE)
Está en la versión 2.0 Provee un SoapExtension para usar con WebMethods Provee un API de transporte de mensajes neutral que no depende de ASMX Implementa varias especificaciones WS-* TechEd 2002
49
Soporte WSE 2.0 a WS-* Messaging Reliability Security Transactions
WS-Addressing WS-Eventing MTOM (Attachments) Reliability WS-ReliableMessaging Security WS-Security WS-Trust WS-SecureConversation WS-Federation Transactions WS-Coordination WS-AtomicTransaction WS-BusinessActivity Metadata WS-Policy WS-PolicyAssertions WS-PolicyAttachment WS-SecurityPolicy WS-Discovery WS-MetadataExchange Implementadas en WSE 2.0 TechEd 2002
50
WSE 1.0 y 2.0 WSE 2.0 puede ser instalada side-by-side con WSE 1.0
Usa un nombre de assembly diferente Usa un namespace diferente La misma token pública WSE 1.0 WSE 2.0 Assembly Microsoft.Web.Services Microsoft.Web.Services2 Namespace Version Public Key Token 31bf3856ad364e35 TechEd 2002
51
Comenzando a usar WSE 2.0 Para comenzar a usar WSE en un WebMethod
Agregar una referencia a Microsoft.Web.Services2 Configurar el WebServicesExtension Agregar using/imports a los namespaces que se necesiten Extender el código del WebMethod apropiadamente // general extension classes using Microsoft.Web.Services2; // if you plan to use WS-Security using Microsoft.Web.Services2.Security; ... TechEd 2002
52
Configuración en web.config
<!--This element adds WSE functionality --> <configuration> <system.web> <webServices> <soapExtensionTypes> <add type= "Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2, Version= , Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="1" group="0" /> </soapExtensionTypes> </webServices> TechEd 2002
53
Usando SoapContext Dentro de un WebMethod, la información WSE está disponible via la clase SoapContext [WebService(Namespace=" public class Endpoint1 : WebService { [WebMethod] public string Echo() SoapContext reqCtx = RequestSoapContext.Current; SoapContext resCtx = ResponseSoapContext.Current; ... // use Soapcontext to interface with the WS-* // implementations } TechEd 2002
54
Usando WSE en el cliente
Los clientes wsdl.exe puede utilizar WSE Cambiar la clase base a WebServicesClientProtocol // wsdl.exe generated proxy ... public class Endpoint1 : // manually change the base class Microsoft.Web.Services2.WebServicesClientProtocol { Endpoint1 e = new Endpoint1(); SoapContext reqCtx = e.RequestSoapContext; SoapContext resCtx = e.ResponseSoapContext; ... // use Soapcontext to interface with the WSA // implementations TechEd 2002
55
Configuración adicional de WSE
Se configura WSE con una nueva sección config (microsoft.web.services2) Se debe registrar la sección antes de usarla <configuration> <configSections> <section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.Web ServicesConfiguration, Microsoft.Web.Services, Version= , Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </configSections> ... TechEd 2002
56
microsoft.web.services
La sección en el config se usa para configurar: Seguridad Política Ruteo Diagnósticos Filtros <configuration> <microsoft.web.services2> <security> ... <policy> ... <referral> ... <diagnostics> ... <filters> ... </microsoft.web.services2> </configuration> TechEd 2002
57
Integración con Visual Studio .NET
WSE 2.0 provee integración con Visual Studio .NET Elegir edición “Developer” al isntalar Clic derecho en proyectoy seleccionar “WSE 2 Settings” La herramienta automatiza la configuración del config TechEd 2002
58
Herramienta WSE Settings
Permite … Agregar la referencia al assembly WSE Configurar el SoapExtension Configurar el soporte a protocolo WS-* TechEd 2002
59
Integración Cliente con Visual Studio .NET
Puede habilitarse WSE en proyectos cliente con la herramienta Cunado se agrega una “Web Reference”, genera dos clases proxy Una que usa WSE (ej: “MathServiceWse”) Y una que no lo usa (ej: "MathService") TechEd 2002
60
WSE 2.0 Tracing WSE ofrece tracing de mensajes built-in
Registra todos los mensajes SOAP de entrada/salida Registra los match de políticas // enable tracing in app.config or web.config <configuration> <microsoft.web.services2> <diagnostics> <trace enabled="true" input="inputtrace.xml" output="outputtrace.xml"/> </diagnostics> </microsoft.web.services2> ... TechEd 2002
61
Características claves de WSE 2.0
TechEd 2002
62
Soporte a seguridad WSE 2.0
WSE 2.0 soporta WS-Security Autenticación (UsernameToken, X.509, Kerb) Integridad (XML signatures) Privacidad (XML encryption) WSE 2.0 soporta WS-Trust y WS-SecureConversation Usando tokens de seguridad de contexto Conversación segura “automática” WSE 2.0 soporta seguridad basada en roles IPrincipal, IsInRole, etc. TechEd 2002
63
Soporte a Policy WSE 2.0 WSE 2.0 soporta WS-Policy
Una policy es un archivo de configuración que especifica los requerimientos para los mensajes También soporta WS-PolicyAssertion y WS-SecurityPolicy WSE 2.0 usa las policies de dos maneras Fuerza las políticas cuando se reciben los mensajes Puede aplicar políticas (para modificar el mensaje) cuando se envían WSE 2.0 soporta custom policy TechEd 2002
64
WSE 2.0 Addressing y Routing
WSE 2.0 usa WS-Addressing para rutear y entregar mensajes WSE 2.0 provee un manejador de ruteo Soporta WS-Referral para instrucciones de ruteo Soporta ruteo basado en contenido WSE 2.0 provee opciones de ruteo seguro TechEd 2002
65
API de Mensajería WSE 2.0 TechEd 2002
66
API de Mensajería WSE ASMX está atado a HTTP, RPC, y métodos
Hace pensar en “client/server” El API de mensajería de WSE 2.0 ofrece un modelo más flexible Basado en mensaje - (not necesariamente método) Independiente de transporte (in-proc, TCP, and HTTP) Permite mensajería asincrónica Patrones de intercambio de mensajes personalizados (MEPs) TechEd 2002
67
Senders y Receivers WSE permite pensar en términos de “senders” y “receivers” Algunos nodos envían mientras otros reciben mensajes Los roles son completamente intercambiables Expuestos via SoapSender y SoapReceiver Sender Receiver and Sender Receiver TechEd 2002
68
Transparencia de transporte
WSE 2.0 permite enviar mensajes por diferentes transportes In-proc, TCP, and HTTP out-of-the-box Transportes personalizados SOAP intermediaries MSMQ initial sender ultimate receiver FTP SMTP HTTP TechEd 2002
69
SoapReceiver SoapReceiver encapsula el proceso de recibir un mensajes SOAP public class MathReceiver : SoapReceiver { protected override void Receive(SoapEnvelope e) // implement Receive here } ... Uri receiverUri = new EndpointReference( new Uri("soap.tcp://localhost/math")); MathReceiver math = new MathReceiver(); SoapReceivers.Add(receiverUri, math); TechEd 2002
70
SoapSender SoapSender encapsula el proceso de enviar un mensaje SOAP a una URI ... SoapEnvelope env = CreateAddMessage(); env.Context.Action = "urn:math:add"; SoapSender ss = new SoapSender(new EndpointReference( Uri("soap.tcp://localhost/math"))); ss.Send(env); TechEd 2002
71
SoapClient y SoapServer
SoapClient y SoapServer ofrecen abstracciones de alto nivel Construidos sobre SoapSender y SoapReceiver Mensajes de request/response y de correlación automática public class MathService : SoapService { [SoapMethod("urn:math:add")] public SoapEnvelope Add(SoapEnvelope e) ... // implement Add here } ... TechEd 2002
72
WseWsdl2.exe WseWsdl2.exe genera código SoapClient de definiciones WSDL El código generado deriva de SoapClient Se puede usar esta clase para enviar mensajes SOAP a receptores SOAP via WSE 2.0 TechEd 2002
73
Resumen Microsoft's Web Services Enhancements (WSE) provee implementación WS-* para usar en .NET hoy WSE 2.0 extiende el framework de WebMethod WSE 2.0 provee integración con Visual Studio .NET TechEd 2002
74
Referencias MSDN WS Developer Center TechEd 2002
75
© 2004 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. TechEd 2002
Presentaciones similares
© 2025 SlidePlayer.es Inc.
All rights reserved.