spring and soa (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
Spring and SOA
Merelbeke, 7/11/2006
Agenda What is SOA
JAXB2, Spring WS en XFire
JBI and the ESB
ServiceMix
About SOASERVICE ORIENTED ARCHITECTURE
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
Elements of SOA
Stages of SOA
Fundamental SOA Only basic services
◦ Data-centric: exposes resources◦ Logic-centric: encapsulate business rules
Resources are never shared between services
Better Maintainability
Networked SOA Introduce intermediate services
◦ Techonology Gateways◦ Adapters◦ Façades (?)◦ Decorating services
Easier integration into Application frontends
More Flexibility
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
Implementing basic Services
Implementing Services Traditional Web Services: RPC
◦ Remote Procedure Call
SOA Web Services: contract first◦ First define the messages, then implement the code◦ Maximum interoperability
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
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
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
JBI and the ESBJAVA BUSINESS INTEGRATION
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
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
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
ServiceMix JBI ContainerAN AGILE ENTERPRISE SERVICE BUS POWERED BY SPRING
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
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