Spring and SOA (2006)

21
Spring and SOA Merelbeke, 7/11/2006

description

Presentation from the good old days when we thought SOA was the golden hammer. Detailing some implementations like Spring/XFire, JAXB and ServiceMix.

Transcript of Spring and SOA (2006)

Page 1: Spring and SOA (2006)

Spring and SOA

Merelbeke, 7/11/2006

Page 2: Spring and SOA (2006)

Agenda What is SOA

JAXB2, Spring WS en XFire

JBI and the ESB

ServiceMix

Page 3: Spring and SOA (2006)

About SOASERVICE ORIENTED ARCHITECTURE

Page 4: Spring and SOA (2006)

What is “Service Oriented Architecture”?

"Things should be made as simple as possible, but no simpler." -- Albert Einstein

Applications build on Loosely Coupled Services◦ Distributed resources◦ Made available as independent services◦ Services that are interoperable ◦ Interoperability based on contracts

Separation of Concerns

Page 5: Spring and SOA (2006)

Elements of SOA

Page 6: Spring and SOA (2006)

Stages of SOA

Page 7: Spring and SOA (2006)

Fundamental SOA Only basic services

◦ Data-centric: exposes resources◦ Logic-centric: encapsulate business rules

Resources are never shared between services

Better Maintainability

Page 8: Spring and SOA (2006)

Networked SOA Introduce intermediate services

◦ Techonology Gateways◦ Adapters◦ Façades (?)◦ Decorating services

Easier integration into Application frontends

More Flexibility

Page 9: Spring and SOA (2006)

Process-Enabled SOA Introduce process-centric service(s)

◦ Statefull intermediate service◦ Hides process state from application frontend◦ Process state can be shared for multiple users◦ Can be event driven

Application frontend concentrates on User Interface (GUI or B2B)

Full Separation of Concerns

Page 10: Spring and SOA (2006)

Implementing basic Services

Page 11: Spring and SOA (2006)

Implementing Services Traditional Web Services: RPC

◦ Remote Procedure Call

SOA Web Services: contract first◦ First define the messages, then implement the code◦ Maximum interoperability

Page 12: Spring and SOA (2006)

JAXB 2: Java Architecture for XML Binding

Java 6 standard extension for Java/XML Binding SchemaGen: generate xsd/wsdl from java pojo’s

◦ Customisable with javax.xml.bind annotations◦ javax.jws @WebService/ @WebMethod annotations

XJC: generate java from xsd/wsdl◦ Generate pojo’s with javax.xml.bind/javax.jws annotations◦ Customisable with xsd annotations or binding files◦ Plugin API for e.g. naming conventions or generating EJB3

annotations ◦ Ant task, maven plugin, eclipse plugin

Code example

Page 13: Spring and SOA (2006)

Implementing services with XFire and Spring

Codehaus XFire: next generation java SOAP◦ Support for newest standards:

◦ JAXB 2.0: annotation based XML binding◦ JSR-181/JAX-WS 2.0: annotations for WSDL generation

◦ POJO based◦ Integration with Spring-core and Spring-MVC

Code example

Page 14: Spring and SOA (2006)

Implementing services with Spring-WS

Document-driven web services◦ Can use XML directly as SAX, DOM, StAX…

◦ For efficiency, flexibility

◦ Can plugin Castor/JAXB/JiBX Marshallers

Similar architecture as Spring-MVC◦ Configurable Dispatcher◦ Endpoints as Controllers◦ Mappings/Filters/Interceptors…

Code example

Page 15: Spring and SOA (2006)

JBI and the ESBJAVA BUSINESS INTEGRATION

Page 16: Spring and SOA (2006)

About JBI Standards based API for Service Bus in a SOA

Normalized Message Router API

Container API for deploying Service Engines and Binding Components◦ Service Engine

◦ Business logic service◦ Transformation service◦ Integration of multiple services

◦ Binding Component◦ Connectivity to external services◦ Consumer or provider

Page 17: Spring and SOA (2006)

JBI Message interfaces NormalizedMessage

◦ content: XML◦ attachments: name -> Mime content◦ properties: name -> object◦ security subject: authentication subject

MessageExchange: W3C Message exchange patterns◦ messages: name -> normalized message◦ exchange id: GUID◦ endpoint: service endpoint◦ service, interface name, operation: QName◦ subinterfaces: InOnly, InOptionalOut, InOut, RobustInOnly◦ status: ACTIVE, DONE, ERROR

Page 18: Spring and SOA (2006)

JBI Component interfaces

Component◦ Lifecycle interface for service units

ServiceEndpoint◦ Addres of a service◦ List of interfaces◦ List of operations

ComponentContext◦ Callbacks for service units◦ Get delivery channel: accept/send MessageExchange◦ Get other ServiceEndpoints

Page 19: Spring and SOA (2006)

ServiceMix JBI ContainerAN AGILE ENTERPRISE SERVICE BUS POWERED BY SPRING

Page 20: Spring and SOA (2006)

ServiceMix JBI Container

Bindings for common Java Technologies◦ SOAP Bindings: plain HTTP/SOAP, jsr-181, X-Fire, ...◦ JMS Binding for plain JMS and JMS+SOAP◦ Quartz scheduler consumer binding◦ FTP provider and consumer◦ Bindings for JavaMail, HTTP, RSS, jabber ...

Service Engines◦ Generic Routing patterns: router, filter, splitter, aggregator, ...◦ XSLT transformation◦ Support for BPEL engines: Intalio PXE en Apache ODE◦ Support for Oracle XSQL

JBI Component Adaptors for POJO’s◦ Real POJO’s: use reflection◦ Implement JBI interfaces or use annotations

Page 21: Spring and SOA (2006)

Using ServiceMix Deployment options

◦ Standalone container with hot-deploy◦ Bundled with Apache Geronimo J2EE container◦ JBoss deployer

Spring based configuration◦ XML namespaces avant la lettre

Code example