j2ee blueprint chapter one : introduction chin-yi tsai
TRANSCRIPT
J2EE BlueprintJ2EE BlueprintChapter One Chapter One :: IntroductionIntroduction
Chin-Yi TsaiChin-Yi Tsai
22
OutlineOutline IntroductionIntroduction
Web ServicesWeb Services
Challenges of Web Services DevelopmentChallenges of Web Services Development• Security, Reliability, Availability, ScalabilitySecurity, Reliability, Availability, Scalability
Typical Web Services ScenariosTypical Web Services Scenarios
J2EEJ2EE :: The Platform for Web ServicesThe Platform for Web Services
33
IntroductionIntroduction J2EE platformJ2EE platform has become an integrated standard for has become an integrated standard for
implementing and deploying portable and distributed implementing and deploying portable and distributed enterprise application.enterprise application.
J2EE platform has added support for J2EE platform has added support for web service-web service-specificspecific components and technologies. components and technologies.• Web service: interoperabilityWeb service: interoperability
• Add Add portabilityportability to web services to web services
J2EE 1.4 platform is the platform of choice for J2EE 1.4 platform is the platform of choice for developing and deploying portable and interoperable developing and deploying portable and interoperable Web Services (Web Services (newnew) and enterprise applications () and enterprise applications (oldold).).
44
This Book …This Book … About developing robust, effective About developing robust, effective Web servicesWeb services on on
the Java 2 platform, Enterprise Edition (J2EE).the Java 2 platform, Enterprise Edition (J2EE).
Describe the technologies used for Web Service.Describe the technologies used for Web Service.
Guidelines for using these technologies to design and Guidelines for using these technologies to design and develop web services.develop web services.
55
Web Service DefinitionWeb Service Definition W3C: A Web service is a software system identified by a URI
whose public interfaces and bindings are defined and described using XML. Its definition can be discovered by other software systems. These systems may then interact with the Web service in a manner prescribed by its definition, using XML-based messages conveyed by Internet protocols.
A Web service is a software application/component, accessible on the Web through an URL, that is accessed by clients using XML-based protocols, such as Simple Object Access Protocol (SOAP) sent over accepted Internet protocols, such as HTTP. Clients access a Web service application through its interfaces and bindings, which are defined using XML artifacts, such as a Web Service Definition Language (WSDL) file.
66
Web ServiceWeb Service Enable Enable application-to-applicationapplication-to-application communication and communication and
interoperability.interoperability.
These reusable, self-contained application provide a These reusable, self-contained application provide a standardized waystandardized way for applications to expose their for applications to expose their functionality over the Web or communicate with functionality over the Web or communicate with other applications over a network, regardless of the other applications over a network, regardless of the application’s implementation, programming application’s implementation, programming language, or computer platform.language, or computer platform.
Web services promote interoperability across Web services promote interoperability across different platforms, systems, and language.different platforms, systems, and language.
77
Web ServiceWeb Service A web service is a A web service is a service-oriented architectureservice-oriented architecture, ,
which is simply a collection of services that which is simply a collection of services that communicate with each other through well-defined communicate with each other through well-defined and well-known interface.and well-known interface.
88
Service-Oriented ArchitectureService-Oriented Architecture
Service provider
UDDi
Servicerequestor
XMLUDDIWSDLSOAP
Well-defined interfaceRegistryQueryAccess the service directly
99
Web Service Related StandardWeb Service Related Standard UDDIUDDI
• 服務註冊服務註冊• 服務查詢服務查詢
WSDLWSDL• 服務描述服務描述• 介面介面
SOAPSOAP• 如何包裝 如何包裝 & & 傳送傳送
XMLXML
1010
Benefits of Web ServicesBenefits of Web Services InteroperabilityInteroperability in heterogeneous environment in heterogeneous environment
• Key benefitKey benefit
Business services through the webBusiness services through the web
Integration with existing systemsIntegration with existing systems• 已有大量的資料存在舊有的已有大量的資料存在舊有的 EISEIS• replace or …replace or …• Standard way to access middle-tier and back-end servicesStandard way to access middle-tier and back-end services• Database management system and transaction monitorsDatabase management system and transaction monitors
Freedom of choiceFreedom of choice• Tools, products, and technologiesTools, products, and technologies
Support more client typesSupport more client types
Programming productivityProgramming productivity• common programming standardcommon programming standard
1111
Challenges of Web Service DevelopmentChallenges of Web Service Development Evolving technologies and productsEvolving technologies and products
• Standard and specificationStandard and specification
• InteroperabilityInteroperability
• CoordinationCoordination workflow workflow
SecuritySecurity• Authentication Authentication
• AuthorizationAuthorization
• Security at the transport and message levelSecurity at the transport and message level
1212
Challenges of Web Service DevelopmentChallenges of Web Service Development Reliability, availability, and scalabilityReliability, availability, and scalability
• Large-scale distributed applicationsLarge-scale distributed applications
dose a client have to wait for the web service?dose a client have to wait for the web service? the number of failures that occur in a given time the number of failures that occur in a given time
periodperiod
Handler multiple client interactions (increasing)Handler multiple client interactions (increasing) Efficiently manage system resources and servicesEfficiently manage system resources and services Automatic load balancing and failoverAutomatic load balancing and failover
1313
Typical Web Service ScenariosTypical Web Service Scenarios Interaction between business partners, supply chain Interaction between business partners, supply chain
management, inventory management, and even management, inventory management, and even simple services.simple services.
IssuesIssues• Interoperability requirementInteroperability requirement
• Integration requirement (EIS)Integration requirement (EIS)
• Types of clientTypes of client
1414
Adventure Builder enterprise –existing Adventure Builder enterprise –existing enterpriseenterprise
Web service to integrate with its numerous partnersWeb service to integrate with its numerous partners
1515
Integrating with business partnersIntegrating with business partners Integrating with existing enterprise information Integrating with existing enterprise information
systemsystem Reaching diverse clientsReaching diverse clients Aggregation of partner dataAggregation of partner data
1616
DemoDemo http://140.134.26.27:8080http://140.134.26.27:8080
http://140.134.26.27:4848http://140.134.26.27:4848 • Application Server Admin ConsoleApplication Server Admin Console
http://140.134.26.27:8080/ab/main.screenhttp://140.134.26.27:8080/ab/main.screen• JAVA ADVENTURE BUILDER DEMO JAVA ADVENTURE BUILDER DEMO
1717
Types of J2EE JAR FilesTypes of J2EE JAR Files Web Application Archive (WAR)Web Application Archive (WAR) EJB JAREJB JAR J2EE Application Client JARJ2EE Application Client JAR Resource Adapter Archive (RAR)Resource Adapter Archive (RAR) Enterprise Application Archive (EAR)Enterprise Application Archive (EAR)
1818
J2EE J2EE applicationapplication modulesmodules componentscomponents
J2EE application consists of one or more J2EE modules and J2EE application consists of one or more J2EE modules and one J2EE deployment descriptor, packaged in an Enterprise one J2EE deployment descriptor, packaged in an Enterprise Archive (Archive (EAREAR) file, which is a JAR file with the .EAR ) file, which is a JAR file with the .EAR extension. extension.
J2EE modules :J2EE modules : J2EE modules consist of one or more J2EE J2EE modules consist of one or more J2EE components of the same type and one component deployment components of the same type and one component deployment descriptor. descriptor. • Web moduleWeb module
• EJB moduleEJB module
• Application client moduleApplication client module
1919
J2EE 1.4J2EE 1.4 :: The Platform for Web ServicesThe Platform for Web Services The J2EE platform is designed to provide server-side The J2EE platform is designed to provide server-side
and client-side for developing Web Services and and client-side for developing Web Services and distributed, multi-tier enterprise application.distributed, multi-tier enterprise application.
Multi-tier modelMulti-tier model
Component-based developmentComponent-based development• reusabilityreusability
Container-based component managementContainer-based component management
2020
PortabilityPortability Define a set of related specificationDefine a set of related specification
• The Enterprise JavaBeanThe Enterprise JavaBean
• The Java Servlet specThe Java Servlet spec
• JSP specJSP spec
• Java API for XML-based RPC specJava API for XML-based RPC spec
J2EE Compatibility Test SuiteJ2EE Compatibility Test Suite J2EE reference implementationJ2EE reference implementation J2EE SDKJ2EE SDK
2121
Support for the WS-I standard for Support for the WS-I standard for interoperabilityinteroperability
The J2EE 1.4 platform includes spec and tech that The J2EE 1.4 platform includes spec and tech that support support SOAPSOAP, , WSDLWSDL, , UDDIUDDI, and , and ebXMLebXML..• Simple Object Access ProtocolSimple Object Access Protocol• Web Service Description LanguageWeb Service Description Language• Electronic Business using eXtensible Markup LanguageElectronic Business using eXtensible Markup Language
Java API for XML-based RPC (JAX-RPC)Java API for XML-based RPC (JAX-RPC) Java API for XML Messaging (JAXM)Java API for XML Messaging (JAXM) SOAP with Attachments API for Java (SAAJ)SOAP with Attachments API for Java (SAAJ) Java API for XML Registries (JAXR)Java API for XML Registries (JAXR) Java API for XML Processing (JAXP)Java API for XML Processing (JAXP) Java API for XML Binding (JAXB)Java API for XML Binding (JAXB)
2222
J2EE Platform BenefitsJ2EE Platform Benefits Simplifies architecture and developmentSimplifies architecture and development
Ensures support for emerging Web service standardEnsures support for emerging Web service standard
Ensure the development of portable and interoperable servicesEnsure the development of portable and interoperable services
Allow for integration with existing information systemAllow for integration with existing information system• Industry-standard APIIndustry-standard API• J2EE Connector architectureJ2EE Connector architecture• JDBCJDBC• JMSJMS
Is scalable to meet demand variationsIs scalable to meet demand variations• J2EE J2EE containerscontainers provide transaction support, database connections, life cycle provide transaction support, database connections, life cycle
management, and other services that are both scalable and require no code management, and other services that are both scalable and require no code from application developersfrom application developers
Provides a flexible security modelProvides a flexible security model• EJB, Servlet APIEJB, Servlet API• Specified at deployment timeSpecified at deployment time
2323
J2EE PlatformJ2EE Platform Java Mail APIJava Mail API Java Message ServiceJava Message Service Java Naming and Directory Interface (JNDI) APIJava Naming and Directory Interface (JNDI) API Java Transaction APIJava Transaction API JDBC APIJDBC API EJBEJB RMI-IIOPRMI-IIOP JSPJSP ServletServlet
2424
2525
J2EE TechnologiesJ2EE Technologies ComponentsComponents
ServicesServices
CommunicationsCommunications
2626
Three Kinds of ComponentsThree Kinds of Components Client componentClient component
• AppletsApplets
• Standalone java application clientStandalone java application client
Web componentWeb component• ServletServlet
• JSPJSP
Enterprise JavaBeansEnterprise JavaBeans 是一種以分散式運算為基礎的元是一種以分散式運算為基礎的元件架構件架構• 部署時做最佳化部署時做最佳化• 允許被部署在相容的 允許被部署在相容的 J2EE J2EE 伺服器上伺服器上
2727
Session Beans Session Beans 主要處理企業邏輯主要處理企業邏輯• 通常面對的是 通常面對的是 Client (EJB Client)Client (EJB Client)• 分為兩大類分為兩大類
Stateful Session BeanStateful Session Bean Stateless Session BeanStateless Session Bean
Entity Beans Entity Beans 主要負責處理資料庫處理主要負責處理資料庫處理• 通常 通常 Entity Bean Entity Bean 代表資料庫的表格代表資料庫的表格• 分為兩大類分為兩大類
Bean Managed PersistenceBean Managed Persistence Container Managed PersistenceContainer Managed Persistence
Message Driven Beans Message Driven Beans 主要負責處理 主要負責處理 MQ Server MQ Server 所收到的所收到的訊息訊息• 通常 通常 Message Driven Beans Message Driven Beans 不會主動被觸發不會主動被觸發• 可以處理兩大種類的訊息可以處理兩大種類的訊息
TopicTopic QueueQueue
2828
ServicesServices ContainerContainer
• Application client containerApplication client container
• Web containerWeb container
• EJB containerEJB container
Container servicesContainer services• Naming serviceNaming service
• Deployment serviceDeployment service
• Transaction serviceTransaction service
• Security serviceSecurity service
2929
Communication Communication These communication tech bring the platform’s component These communication tech bring the platform’s component
and services together, making the J2EE platform an and services together, making the J2EE platform an integratedintegrated, , standardstandard platform for developing portable, interoperable platform for developing portable, interoperable enterprise application and web service.enterprise application and web service.
Internet protocolInternet protocol• HTTP, TCP/IP, SSLHTTP, TCP/IP, SSL
Remote Method Invocation protocolRemote Method Invocation protocol• JRMPJRMP
Messaging technologiesMessaging technologies• JMS and JavaMail APIJMS and JavaMail API
Web Service technologiesWeb Service technologies• SOAP: Java API for XML-based RPCSOAP: Java API for XML-based RPC
• UDDI: Java API for XML Registries UDDI: Java API for XML Registries
3030
Book OrganizationBook Organization Chapter 2Chapter 2
• Standard and technologiesStandard and technologies Chapter 3Chapter 3
• Service endpoint designService endpoint design Chapter 4Chapter 4
• Client designClient design Chapter 5Chapter 5
• XML processingXML processing Chapter 6Chapter 6
• Application and data integrationApplication and data integration Chapter 7Chapter 7
• SecuritySecurity Chapter 8Chapter 8
• Application architectureApplication architecture