SOA conference
Microsoft BizTalk Server 2006 R2BizTalk Adapters for WCFTomás Hernández // MVP for BizTalkilitia Technologies
weblog: http://blogs.clearscreen.com/tomas
e-mail: [email protected]
SOA conference
Agenda
Qué es WCFFundamentos de la Arquitectura WCFAdaptadores BizTalk WCFNovedades en BizTalkDemo
SOA conference
Qué es WCF
Conjunto de tecnologías .Net de Microsoft para el desarrollo de Aplicaciones DistribuidasAnteriormente “Indigo”Unifica el modelo de programación para COM+/MSMQ/Web Services/.NET Remoting entre otrosPromueve los principios de SOAImplementa la especificación WS-*¿Por qué usarlo?
Conectividad entre aplicacionesModelo de programación unificadoAmplia interoperabilidadArquitectura extensibleMúltiples escenarios de seguridad
SOA conference
Fundamentos de la Arquitectura WCF
Fundamentos de la Arquitectura WCFEndPoint: Extremos o puntos de entrada de WCF
Client Service
EndpointEndpoint
Endpoint
EndpointMessage
SOA conference
Fundamentos de la Arquitectura WCF
WCF: Address, Binding, Contract:Address: dirección de red donde reside el EndPoint Binding: cómo se comunica el EndPoint . Contract: qué comunica. Organizado en operaciones.
Service
CBA
CBA
Client
ABC
Address
Dónde?
Contract
Qué?
Binding
Cómo?
CBAMessage
SOA conference
Fundamentos de la Arquitectura WCF
Servicio WCF: programa que expone una colección de EndPoints
Cliente WCF: programa que intercambia mensajes con uno o más EndPoints.
Client Service
ClientChannel
Message
ABC
ServiceHost
CBA
CBA
CBA
SOA conference
Fundamentos de la Arquitectura WCFContratos y Servicios[ServiceContract]public interface IHello{ [OperationContract] string Hello(string name);}
public class HelloService : IHello{ public string Hello(string name) { return “Hello, ” + name; }}
ServiceContract Aplicado generalmente a un tipo del interfaceDefine el PortType en el WSDLOperationContractAplicado a un método de un interfaceDefine la operación del PortType
SOA conference
Fundamentos de la Arquitectura WCFclass HelloHost{ static void Main(string[] args) { ServiceHost host = new ServiceHost(typeof(HelloService)); host.Open(); // Wait until done accepting connections Console.ReadLine(); host.Close(); }}
<%@ ServiceHost Language=“C#” Service=“HelloService” %>
http://localhost/HelloService/HelloService.svcWAS/IIS-host
Self-host
SOA conference
Fundamentos de la Arquitectura WCFBindings
Que especificación WS-* se usaQue protocoloQue encoding de mensajeBindings pueden ser por código o en .config
<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services> <service type=“HelloService" <endpoint address=“http://localhost/HelloService" binding=“basicHttpBinding" contract="IHello" /> </service> </services> </system.serviceModel></configuration>
SOA conference
Fundamentos de la Arquitectura WCFImplementación del clienteclass Client{ static void Main() { IHello proxy = ChannelFactory.
CreateChannel<IHello>(“HelloEndpoint”); string r = proxy.Hello(“Tomi”); Console.WriteLine(r); }}
<system.serviceModel> <client> <endpoint configurationName=“HelloEndpoint" address="http://localhost/HelloService" binding="basicHttpBinding" contract="IHello" /> </client></system.serviceModel>
SOA conference
Fundamentos de la Arquitectura WCFContratos
[DataContract]public class Order{ [DataMember] public int orderID; [DataMember] public int partNumber; [DataMember] public int price; [DataMember] public string info;}
[DataContract]public class Query{ [DataMember] public int orderID;}
[DataContract]public class Info{ [DataMember] public string info;}
[ServiceContract]public interface IOrderService{ [OperationContract] void Process(Order o);
[OperationContract] Info GetInfo(Query q);}
public class Order{ public int orderID; public int partNumber; public int price; public string info;
public void Process(); public GetInfo();}
SOA conference
Novedades en BizTalk
Qué novedades aportan:Envío y recepción de mensajes transaccionalUso de cabeceras WS-* para routing y procesosUso de bindings personalizadosNumerosos escenarios de seguridad – certificados, personalizados, etcEndpoints In-process sin necesidad de HTTP
SOA conference
Adaptadores BizTalk WCF
WCF se ajusta perfectamente a la arquitectura BizTalkWCF Receive Adapters permiten exponer servicios WCFWCF Send Adapters permiten consumir servicios WCFLa configuración es almacenada en los puertos de BizTalk, NO en ficheros .config
SOA conference
Adaptadores BizTalk WCFAdaptadores WCF disponibles en R2
WCF-WsHttp Adapter – soporte del standard WS-* sobre protocolo HTTP. WCF-NetTcp Adapter – soporte del protocolo TCP. WCF-NetMsmq Adapter – soporte para conexión con transporte MSMQWCF-BasicHttp – compatible con la primera generación de WebServicesWCF-NetNamedPipe – habilita comunicación usando transporte NamedPipes. WCF-Custom – Permite usar componentes WCF personalizados (bindings, behaviors y bindings). WCF-Custom adapter. WCF-CustomIsolated – permite conectar a través del transporte HTTP pero fuera del proceso de BizTalk.
SOA conference
Adaptadores BizTalk WCF
Publishing WizardPublicar una orquestación o esquema como HTTP WCF Service en el IISPublicar metadata para adaptador in-proc o out-proc en el IISGenera .svc, ServiceDescription.xml, Web.Config
SOA conference
Adaptadores BizTalk WCFBizTalk WCF Publishing Wizard
SOA conference
Adaptadores BizTalk WCFBizTalk WCF Service Consuming Wizard
Crea los tipos para mensajes y puertosCrea el “proxy”:
Fichero de Bindings, para crear el Send PortMapeo entre acciones y operaciones , para enlazar operaciones de las orquestaciones con operaciones específicas del servicio.<BtsActionMapping> <Operation Name="SubmitInvoice" Action="http://example.org/SubmitInvoice"/> <Operation Name="CancelInvoice" Action="http://example.org/CancelInvoice"/></BtsActionMapping>
SOA conference
Adaptadores BizTalk WCFBizTalk WCF Service Consuming Wizard
SOA conference
DEMO
© 2007 Microsoft Corporation. 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.
Top Related