งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

Session6 : SOA Programming Models

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "Session6 : SOA Programming Models"— ใบสำเนางานนำเสนอ:

1 Session6 : SOA Programming Models
Dr. Nipat Jongsawat

2 หัวข้อนำเสนอ ทบทวน SOA การพัฒนาโปรแกรมใน SOA Web 2.0 & Mashups
WCF : Windows Communication Foundation SCA : Service Component Architecture Web 2.0 & Mashups Dr. Nipat Jongsawat

3 Service-Oriented Architecture
เป็นเรื่องของแนวคิด การออกแบบ เพื่อให้ระบบ รองรับ การเปลี่ยนแปลง (interface / implementation) ความหลากหลาย (language, access method) ง่ายต่อ การพัฒนาบริการใหม่ การประกอบบริการที่มีอยู่ Dr. Nipat Jongsawat

4 จากอดีตถึงปัจจุบัน XML WS Web LAN Internet SOA 1970 1980 1990 2000
Distributed Component Architecture Service-Oriented Architecture Monolithic Architecture Client-Server Architecture Number of tiers 1 2 n Technology Enabler Prog. Lang. (Cobol...) Data Access (ODBC...) Dist. Prog. (CORBA, RMI, COM,...) Web Service Std. (XML, SOAP Level of Interop. Intra-app. Cross Clients Cross App. Intra Enterprise Cross App. Cross Enterprise Common Elements Same physical node, technology, progam Same technology Same Comm.& messaging std. Dr. Nipat Jongsawat

5 การเปลี่ยนแนวคิดเป็นแบบบริการ
From To Connections = cost Function oriented Build to last Prolonged development Connections = value Process oriented Build for change Incrementally deployed Application silos Tightly coupled Object oriented Homogeneous Orchestrated solutions Loosely coupled Message oriented Heterogenous Dr. Nipat Jongsawat

6 Tightly Coupled Objects  Loosely Coupled Services
เรา เขา Programming Language Agreements Database Database Operating System Object Model Operating System Application Contract เรา เขา Programming Language Programming Language Agreements Database Database Object Model Object Model Contract Operating System Operating System Application Application Dr. Nipat Jongsawat

7 เรียกใช้บริการอย่างไร
Loose Coupling ผู้ให้บริการ ผู้รับบริการ ออกแบบขั้นตอนทำงาน มีบริการอะไรให้ใช้ สร้างให้เป็นจริง Contract เรียกใช้บริการอย่างไร เปิดให้บริการ บริการอยู่ที่ใด เผยแพร่บริการ Dr. Nipat Jongsawat

8 แนวคิดเชิงบริการ Applications composed of Operational Requirements
enforce State manage governed by Policies Services Contracts bound by have Messages exchange Message Exchange Pattern describe define structure of is a set of contain Schemas Dr. Nipat Jongsawat

9 หลัก 4 ประการของแนวคิดเชิงบริการ
Boundaries are explicit Services are autonomous Share schema & contract, not class Compatibility based on policy Dr. Nipat Jongsawat

10 ลักษณะของเซอร์วิซ Message Oriented Loosely Coupled Course Grained
Contract Based Sync and Async Invokeable Orchestratable Reusable And Ideally Interoperable Dr. Nipat Jongsawat

11 การสื่อสารระหว่างเซอร์วิซ
Service การสื่อสารระหว่างเซอร์วิซ Sign Serialize Message Processing Infrastructure Reliable messaging Service Encrypt Deserialize Authorize Message Processing Infrastructure Validate Audit Log Authenticate Dr. Nipat Jongsawat

12 Services : Objects การพัฒนาระบบ OO จัดการ network apps
ใช้ความเชี่ยวชาญเดิม การพัฒนาระบบ OO จัดการ network apps การ deploy service : host ที่เครื่องเรา object : ส่งให้เครื่องเขา language constructs language libraries object models distributed objects service models Dr. Nipat Jongsawat

13 แต่ก่อน นักพัฒนามีภาระมาก ต้องตัดสินใจเยอะ ตัวโปรแกรมผสมผสาน
J2EE : RMI, JAX-RPC, EJB, JMS, ... .NET : Remoting, ASMX/WSE, DCOM, MSMQ, ... APIs มีมากมาย เปลี่ยนบ่อย และลึกทางเทคนิค ตัวโปรแกรมผสมผสาน business logic service communication Dr. Nipat Jongsawat

14 ปัจจุบัน มาตรฐานเข้ารูป เครื่องมือเข้าร่าง
หลายฝ่ายร่วมมือ ไม่ยึดติด เครื่องมือเข้าร่าง ใช้ง่าย นักพัฒนาสนใจเฉพาะ core business logic ผลักเรื่อง communication, transaction, deployment, policy ไปจัดการที่ส่วนกลาง Dr. Nipat Jongsawat

15 หัวข้อนำเสนอ ทบทวน SOA การพัฒนาโปรแกรมใน SOA Web 2.0 & Mashups
WCF : Windows Communication Foundation SCA : Service Component Architecture Web 2.0 & Mashups Dr. Nipat Jongsawat

16 .NET Framework 3.0 Dr. Nipat Jongsawat

17 Services, Workflow, BizTalk
WCF WF API for building secure, reliable interoperable services Tools and engine for building workflow-enable apps Application to application and B2B integration Connects multiple services built with WCF Adapters to multiple products like SAP and MQSeries Business activity monitoring Vertical solutions and industry accelerators Message transformation services Enterprise single sign-on End-to-end health and activity tracking And more… Dr. Nipat Jongsawat

18 public class MsmqTest { [STAThread] static void Main(string[] args) {
string queuePath MessageQueue messageQueue; if (MessageQueue.Exists(queuePath)) messageQueue = new MessageQueue(queuePath); else messageQueue = MessageQueue.Create(queuePath); messageQueue.Send("Hello World!"); ... } public class hello : MarshalByRefObject { public String HelloWorld() { return "Hello World"; } public class hello { [WebMethod] public string HelloWorld() { return "Hello World"; } Dr. Nipat Jongsawat

19 WCF : Unifying Communication
.NET Framework 2.0 Applications ASMX & WSE .NET Remoting Enterprise Services System. Messaging API MSMQ SOAP & WS-* Remoting binary DCOM Protocol Applications .NET Framework 3.0 Windows Communication Foundation API Others SOAP & WS-* WCF binary protocol MSMQ Protocol Dr. Nipat Jongsawat

20 hosted in IIS, WAS, self-host,
WCF Service Endpoints S E R V I C E NETWORK Endpoint Endpoint Endpoint Metadata CLIENT hosted in IIS, WAS, self-host, Windows service Endpoint Dr. Nipat Jongsawat

21 Service Endpoints WCF Service :โปรแกรมที่เผยแพร่ endpoints ของมัน
Address : service อยู่ทีไหน (where) Binding : ติดต่อกันอย่างไร (how) Contract : ให้บริการอะไร (what) ลดภาระของผู้พัฒนาเซอร์วิส สนใจเฉพาะ business function ไม่ต้องพะวงเรื่องวิธีการติดต่อกับเครือข่าย Dr. Nipat Jongsawat

22 WCF : Service Implementation (C#)
[ServiceContract] class HelloService { [OperationContract] string sayHello() return ("Hello"); } Dr. Nipat Jongsawat

23 Hosting Service http://localhost/hello?wsdl class program {
static void Main(string[] args) { Uri base = new Uri(" ServiceHost hs = new ServiceHost( typeof(HelloService), base); hs.AddServiceEndpoint(typeof(HelloService), new BasicHttpBinding(), " hs.AddServiceEndpoint(typeof(HelloService), new NetTcpBinding(), "net.tcp://localhost/hello/svc1"); hs.Open(); Console.WriteLine("Service is ready."); Console.ReadKey(); hs.Close(); } Dr. Nipat Jongsawat

24 Dr. Nipat Jongsawat

25 WCF : Service Client (VB.NET)
Dr. Nipat Jongsawat

26 WCF : Service Client (VB.NET)
Dr. Nipat Jongsawat

27 WCF : Service Client (C#)
Dr. Nipat Jongsawat

28 app.config <?xml version="1.0" encoding="utf-8" ?>
<configuration> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="ServiceMetaBehavior"> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="ServiceMetaBehavior" name="ConsoleApplication1.HelloService"> <endpoint address=" binding="basicHttpBinding" contract="ConsoleApplication1.HelloService" /> <endpoint address=" binding="mexHttpBinding" contract="IMetadataExchange" /> ... Dr. Nipat Jongsawat

29 WCF : Bindings Name Transport Encoding Security
BasicHttpBinding HTTP XML WS-I Basic Profile 1.1 WSHttpBinding HTTP XML Msg. security, reliable session,... NetTcpBinding TCP binary trans security, reliable session,... NetNamedPipeBinding named binary trans security, reliable session, piped NetMsmqBinding MSMQ binary trans security, queue transaction . . . Dr. Nipat Jongsawat

30 WCF : Contracts Contracts : ให้ผู้ให้บริการและผู้ใช้บริการร่วมกันรับรู้และเข้าใจ ServiceContract operations a service can perform (WSDL) DataContract format of data passed to and from service (XSD) MessageContract what goes where in a message (SOAP msg) FaultContract errors likely to be produced (SOAP fault) Dr. Nipat Jongsawat

31 ServiceContract [ServiceContract] public class MyService {
[OperationContract] string operation1() { ... } string operation2() { ... } void helper() { ... } } [ServiceContract] public interface IMyService { [OperationContract] string operation1(); string operation2(); } public class MyService : IMyService { string operation1() { ... } string operation2() { ... } void helper() { ... } } Dr. Nipat Jongsawat

32 DataContract Primitive types have an implicit data contract.
public class Person { [DataMember] public string First; public string Mid; public string Last; private int ID; ... } Primitive types have an implicit data contract. [ServiceContract] public interface IPersonService { [OperationContract] Person GetPerson(int personID); } Dr. Nipat Jongsawat

33 WCF Dr. Nipat Jongsawat

34 หัวข้อนำเสนอ ทบทวน SOA การพัฒนาโปรแกรมใน SOA Web 2.0 & Mashups
WCF : Windows Communication Foundation SCA : Service Component Architecture Web 2.0 & Mashups Dr. Nipat Jongsawat

35 SCA : Service Component Architecture
ข้อกำหนดการสร้าง composite applications ง่ายต่อการพัฒนา การประกอบ และการให้บริการ รองรับหลากหลายภาษาและเทคโนโลยีการพัฒนา POJOs, BPEL, COBOL, C++ … เกิดการร่วมมือของหลากหลายบริษัทชั้นนำ (พ.ย. 2005) BEA, IBM, Oracle, SAP, IONA, Sybase, Interface21, SAP, Progress, Sybase, TIBCO, Siemen, Sun, ... Royalty-free specifications Dr. Nipat Jongsawat

36 SCA : Assembly Model การประกอบ service ใหม่จาก service เดิม
ไม่ขึ้นกับภาษาการโปรแกรม กำหนด service dependencies รองรับการปรับ config ด้วย properties / protocols / qualities of service profiles สามารถปรับ config ได้ทั้งตอน design time และ deployment time Dr. Nipat Jongsawat

37 SCA : Service Assembly tightly coupled codes (Composites)
loosely coupled services (Systems) System SDO Composite A Refe- rence Service Component A B D Composite C Service C Composite B Service Refe- rence Dr. Nipat Jongsawat

38 SCA : Service Composite
Dr. Nipat Jongsawat

39 Service Reference ใช้กำหนด services ข้างนอกที่เราต้องการ
ใช้ binding เพื่อระบุกลไกการสื่อสาร web service, stateless EJBTM JMSTM JCATM ... สามารถปรับเปลี่ยนลักษณะสมบัติด้วย Policy Composite B Service Refe- rence Dr. Nipat Jongsawat

40 Service Entry Point ใช้กำหนดบริการต่าง ๆ ที่เรามีให้
ใช้ binding เพื่อระบุกลไกการสื่อสาร web service, stateless EJBTM JMSTM JCATM ... สามารถปรับเปลี่ยนลักษณะสมบัติด้วย Policy Composite B Service Refe- rence Dr. Nipat Jongsawat

41 SCA : Service Implementation
รองรับการสร้างตัวบริการได้หลายภาษาการโปรแกรม JavaTM, BPEL, C++, PHP, … ใช้บริการภายนอกได้ด้วย service references ให้บริการโดยกำหนดเป็น interfaces ที่มีลักษณะ remotable, conversational, bi-directional, companion callback interface ระบบรองรับการจัดการ state ให้ Dr. Nipat Jongsawat

42 Services : local และ remote
Remotable Service ใช้อ้างอิงได้ทั้งภายในและภายนอก module การส่ง parameter และ return value เป็นแบบ by-value มีลักษณะแบบ coarse-grained, loosely coupled interface Local Service ใช้อ้างอิงได้ภายใน module เท่านั้น การส่ง parameter และ return value เป็นแบบ by-reference มีลักษณะแบบ fine-grained, tightly coupled interface เป็น remotable service กำกับ Java interface Dr. Nipat Jongsawat

43 SCA Client and Implementation Model
ทำให้ง่ายต่อการให้และใช้บริการ ผู้พัฒนาสนใจเฉพาะ business logic ปัจจุบันมีข้อกำหนดของ Java and C++ binding ต่าง ๆ ปรับตั้งได้ขณะทำงาน ปรับเปลี่ยนพฤติกรรมของบริการได้ด้วยการปรับค่าของ properties ต่าง ๆ ของตัวบริการ Dr. Nipat Jongsawat

44 SCA : Service Implementation
package services; import org.osoa.sca.annotations.*; @Remotable public insterface HelloService { String sayHello(); } package services; import org.osoa.sca.annotations.*; @Service(HelloService.class) public class HelloServiceImpl implements HelloService { String sayHello() { return ("Hello"); } Dr. Nipat Jongsawat

45 SCA : Service Client package clients;
import org.osoa.sca.annotations.*; import services.HelloService; public class HelloClient { @Reference private HelloService svc; public static void main(String[] args) { System.out.println( (new HelloClient()).svc.sayHello() ); } Dr. Nipat Jongsawat

46 อีกสักตัวอย่าง @Remotable public interface B {...} @Service(B.class)
public class BImpl implements B { @Reference D dService; C cService; ... } BComp CComp AComposite A D. public interface C {...} @Service(C.class) public class CImpl implements C { ... } Dr. Nipat Jongsawat

47 SCA : Service Implementation
<?xml version="1.0" encoding="ASCII"?> <composite xmlns=" name="AComposite" > <component name="BComp"> <implementation.java class="services.BImpl"/> <reference name="cService>C</reference> <reference name="dService>D</reference> </component> <component name="CComp"> <implementation.java class="services.CImpl"/> <service name="A"> <interface.java interface="services.A"/> <binding.ws port=" wsdl.endpoint(A/ASOAP)"/> <reference>BComp</reference> </service> <reference name="D"> <interface.java interface="ext.D"/> <binding.ws port=" wsdl.endpoint(D/DSOAP)"/> </reference> </composite> SCA : Service Implementation sca.module BComp CComp AComposite A D. Dr. Nipat Jongsawat

48 SCA : Binding กำกับทุก service entry point และ reference
binding.sca, binding.ws, binding.jms, binding.eis <reference name="StockQuoteService"> ... <binding.jms> <connection destinationName="StockQuoteServiceQueue" connectionFactoryName="StockQuoteServiceQCF".../> <operation name="getQuote"> <inDataBinding name=" </operation> </binding.jms> </reference> Dr. Nipat Jongsawat

49 Current SCA Implementations
IBM WebSphere Application Server v6.1 Oracle Event-Driven Architecture Suite TIBCO ActiveMatrix Service Grid ... Open sources Apache Tuscany Eclipse SOA Tools Platform Dr. Nipat Jongsawat

50 WebSphere Integration Developer 6.0
Dr. Nipat Jongsawat

51 Apache Tuscany http://incubator.apache.org/tuscany/
Dr. Nipat Jongsawat

52 SCA Dr. Nipat Jongsawat

53 WCF/SCA : ความเหมือน สร้าง service จาก class
เขียนหมายเหตุกำกับส่วนต่าง ๆ ของคลาส (attributes ใน .NET หรือ annotation ใน Java) เพื่อนิยามบริการ ใช้ binding กำกับตัวบริการเพื่อระบุกลไลการสื่อสาร (มี pre-defined bindings ซึ่งสามารถปรับเปลี่ยนได้) รองรับข้อกำหนดตาม WS-* Dr. Nipat Jongsawat

54 WCF/SCA : ความเหมือน รองรับการสื่อสารทั้งแบบ synchronous calls, แบบ one-way และแบบ two-way interactions (ที่เรียกกันว่า duplex contracts หรือ callback interfaces) รองรับการจัดการ session และ state ระหว่างเรียกใช้บริการ ทั้งคู่มี protocol แบบ optimized เฉพาะของตัวเองด้วย Dr. Nipat Jongsawat

55 WCF/SCA : ความต่าง SCA มีข้อกำหนดการประกอบ components เป็น module โดยระบุ dependencies ระหว่าง components SCA รองรับการสร้าง service-oriented applications ที่พัฒนาด้วยหลากหลายภาษา SCA ทำงานได้บนหลากหลายเทคโนโลยี เช่น EJB, Spring ส่วน WCF นั้นทำงานบน .NET Dr. Nipat Jongsawat

56 รายละเอียดเพิ่มเติม WCF SCA Apache Tuscany Project
SCA Apache Tuscany Project Dr. Nipat Jongsawat

57 หัวข้อ ทบทวน SOA การพัฒนาโปรแกรมใน SOA Web 2.0 & Mashups
WCF : Windows Communication Foundation SCA : Service Component Architecture Web 2.0 & Mashups Dr. Nipat Jongsawat

58 Web 2.0 : Definition Web 2.0 is the network as platform, spanning all connected devices; Web 2.0 applications are those that make the most of the intrinsic advantages of that platform: delivering software as a continually-updated service that gets better the more people use it, consuming and remixing data from multiple sources, including individual users, while providing their own data and services in a form that allows remixing by others, creating network effects through an "architecture of participation," and going beyond the page metaphor of Web 1.0 to deliver rich user experiences. Tim O'Reilly Dr. Nipat Jongsawat

59 1.0 vs 2.0 Akamai  BitTorrent Britannica Online  Wikipedia
personal websites domain name speculation screen scraping publishing content management systems directories (taxonomy) stickiness  BitTorrent  Wikipedia  blogging  search engine optimization  web services  participation  wikis  tagging ("folksonomy")  syndication Dr. Nipat Jongsawat

60 Dr. Nipat Jongsawat

61 http://www. oreillynet
Dr. Nipat Jongsawat

62 Dr. Nipat Jongsawat

63 Web 2.0 Services, not packaged software Data as the driving force
Architecture of participation The Long Tail Rich user experiences Lightweight programming models The perpetual beta Some rights reserved Dr. Nipat Jongsawat

64 Dr. Nipat Jongsawat

65 Mashup Wikipedia : "A mashup is a website or web application that seamlessly combines content from more than one source into an integrated experience." Enterprise Web 2.0 Web 2.0 SOA Mashups Enterprise Mashups Dr. Nipat Jongsawat

66 Dr. Nipat Jongsawat

67 Mashup Styles Mashups "mix & match" Client-side mashups
presentations data functionalities Client-side mashups Server-side mashups Dr. Nipat Jongsawat

68 Dr. Nipat Jongsawat

69 Demo Accessing Web Services from Excel (Microsoft Office Web Services Toolkit) GreaseMonkey : Amazon + CU-Lib ( OpenKapow : CourseDesc + books.google ( ชมภาพยนต์ ( Dr. Nipat Jongsawat

70 Dr. Nipat Jongsawat

71 Dr. Nipat Jongsawat

72 Misc. Mashups vs Composite App Enterprise mashups are dangerous
guerilla-style vs. formal engineering Enterprise mashups are dangerous Confidentiality breaches Unauthorized capabilities Dr. Nipat Jongsawat

73 รายละเอียดเพิ่มเติม Dr. Nipat Jongsawat


ดาวน์โหลด ppt Session6 : SOA Programming Models

งานนำเสนอที่คล้ายกัน


Ads by Google