Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Post on 26-May-2015

2.367 views 0 download

Tags:

description

For a long time, the perception of using Oracle's SOA Suite was that its usage required deep XML knowledge. This has changed dramatically with SOA Suite 11g and the supporting tools. This talk will introduce you to the extended and enhanced Java capabilities all across the platform, the native support for Spring components inside composites, and the WebLogic SCA for Java container. Learn how to transparently leverage existing Java code, and let the platform worry about serialization and XML generation.

Transcript of Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Java Power to the SOA Developer

ODTUG Kaleidoscope 2010Wednesday, 30th June

Clemens Utschig-UtschigLucas Jellema

AMIS, The Netherlands

Overview• Three perspectives

– Java2SOA, SOA2Java, SOA running Java inside• Invoking SOA Composite Application from Java

– WebService, EJB and ADF Binding; JMS• Calling Java from SOA Composite application

– EJB binding, JMS Adapter Service; direct & socket– Java exposed as WebService and as ADF-BC SDO

• Java inside– BPEL Embedded Java; Mediator Java Callout– Spring Context Service Component

From Java, To Java, Run Java

JMS

EJB

JavaApplication

JAX-WSJava Class

ADF-BCADF BC

SDO

JMSJavaApplication

JavaApplication

JavaApplication

EJBADF

Some material used from the book• Shipping before OOW

– End of August

• On SOA and SOA Suite• Chapters on

– Java inside SOA Suite (Java Callout, EmbeddedJava BPEL activity, Springcomponent)

– EJB and ADF Binding– Interaction between

SOA Suite & ADF– SDO Services & BPEL

Invoking SOA Composite Application from Java

• Create Java WebService client (JAX-WS)– Generate in JDeveloper, based on WSDL and XSD– Call over HTTP with XML based messages

• Expose EJB Binding or ADF Binding from Composite– Invoke over RMI with XML

or (serialized) POJOs• Interact from Java over

JMS, through Direct Binding or Socket Adapter

Expose EJB Binding• Create the SOA Composite application• Create a Java Interface that describes the

service to be exposed• Create an EJB binding based on that interface

as external Service exposed by the composite• Create a Mediator wired to the EJB binding

– That routes incoming requests to ‘the rest of the composite’

• Create the Java client that calls over RMI

Create Composite application, WS interface and Java Interface

Create the (inbound) EJB Binding

Invoking the SOA Composite via the EJB Binding

Client of EJB Binding in action

Inbound ADF Binding

• Expose a service with binding.adf– Based on the same WSDL as the binding.ws

• Wire this service to whatever the binding.ws service is wired to

• Incoming calls are overRMI and use XML according to WSDL/XSD

Client for ADF Binding

• Use SOA Suite run-time Java API– Locator class– pointed at t3://localhost:8001/soa-infra

• Lookup Composite– default/FilterAndTranslateWithADFBinding!1.0

• Find Service• Invoke with XML message• Response returned in XML

Overview• Three perspectives

– Java2SOA, SOA2Java, SOA running Java inside• Invoking SOA Composite Application from Java

– WebService, EJB and ADF Binding; JMS• Calling Java from SOA Composite application

– EJB binding, JMS Adapter Service; direct & socket– Java exposed as WebService and as ADF-BC SDO

• Java inside– BPEL Embedded Java; Mediator Java Callout– Spring Context Service Component

Invoking External Java based logic• Expose Java application as JAX-WS WebService• Expose ADF-BC with (SDO) Service Interface

– Use ADF-BC Binding Adapter and BPEL Entity• Invoke Java EJB over EJB Binding• Call out using Direct Binding

or Socket Adapter• Interact using JMS Adapter

Accessing Java based logic exposed by EJBs

• Create and deploy EJB– Get (remote) Java Interface and JNDI name

• Create EJB Binding (reference)– Configure with JNDI name and Java Interface

• Create wire to the EJB Binding– A WSDL is automatically derived from the Java

interface definition

(outbound) EJB Binding

The WSDL is created upon wiring to the EJB binding

Run composite with call via outbound EJB binding

ADF BC providing Data Access service to BPEL processes

• SOA Suite communicates with database through Database Adapter– SQL (select, DML), PL/SQL and polling

• Alternatively, Service Data Objects and a Data Access Service can be used– XML and HTTP based– Stateful dataset & two-way synchronization

ADF Faces Web ApplicationPatientAdministration

SOA Suite

EDN

PATIENTS

Application ModulePatientsService

Entity ObjectPatient

View ObjectPatientsVw

(SDO) Web Service

PatientsService

ADF Business

Components

ADF BC, SDO and BPEL

• ADF BC Application Module can be exposed as Service Interface that is SDO enabled

• The SOA Suite ADF BC binding adapter connects to the SDO Service Interface

• BPEL Variables can be based on SDO Entity– BPEL activity Create Entity does Insert– BPEL activity Bind Entity does retrieve– Assign in BPEL results in call to update on SDO

Expose ADF BC Service Interface

Test SDO enabled Service Interface

Using the ADF-BC Binding Adapter

Create SDO Entity based variable in BPEL process

BPEL activity Bind Entity does ‘select * into BPEL variable’

Overview• Three perspectives

– Java2SOA, SOA2Java, SOA running Java inside• Invoking SOA Composite Application from Java

– WebService, EJB and ADF Binding; JMS• Calling Java from SOA Composite application

– EJB binding, JMS Adapter Service; direct & socket– Java exposed as WebService and as ADF-BC SDO

• Java inside– BPEL Embedded Java; Mediator Java Callout– Spring Context Service Component

Run Java inside SOA Composite

• Extend BPEL processes with Embedded Java– For manipulation of variables, auditing/logging,

external call-outs, validation,..• Mediator Java Callout

– Before or after transformation ofrequest or reply

– For validation, transformation & enrichment, logging, …

• Spring Context service component

Consult Preparation Service

Add translations using Google’s RESTful Translation Service

• Java Class StringTranslator publishes a static method translate that will translate strings:

Add embedded Java activity

Extend with Dutch translations

Extend with Dutch translations

Java Embedding in BPEL process

• Hidden inside, not very decoupled• Hard to maintain• Mixing technology paradigms

– Requiring different skills• In general:

– Useful for advanced logging/tracing– Useful for special validations/transformations

• Use with great caution

Mediator Java Call-outs

• Mediators allow registration of a Java Callout class– This class extends from AbstractJavaCalloutImpl – May override methods invoke at specific moments

in thelife cycle

Mediator Java Call-outs• Used for debugging & logging/auditing,

advanced manipulation (enrichment?), complex validation

Java inside composites: Spring Component

• Primary citizen in SCA Composite applications– As per the SCA Specification– As per 11gR1 PS2 (preview in PS1)

• POJOs configured as Spring Beans provide services inside the Composite– And potentially exposed externally

• Spring’s Dependency Injection is very similar to SCA’s Reference concept

Steps for adding Java logic to a composite application

• Add Spring Context to the composite– A Spring Bean Configuration file is created

• Add bean definitions for POJOs based on Java Interfaces

• Add sca:service elements to exposebeans as service to other components

• Add sca:reference elements to get Service Components injected to satisfy a dependency

First Steps

Use Case: Add PDF generation to a composite application

• PDF Generating Spring Bean is defined in the Spring Content – with an sca:service

Dependency Injection: Spring Beans get Service Components injected

• Dependency injection is the heart and soul of Spring

• References in SCA are very similar• Spring Beans can publish their dependencies

as sca:reference elements– That get exposed by the Spring Context

• These References can be satisfied by wiring in other Service Components– Usually Mediator

Second round

Third round

Injecting LogFileWriter & ConsoleLogger

48

Summary and Conclusion• SOA Composite applications can expose and

access EJB bindings next to WebService– BPEL Entity variables have direct SDO binding

• Service Adapters for Direct Binding, Sockets and JMS interact with Java applications– both incoming and outgoing interaction

• Spring Context Service Component allows Spring Beans (POJOs) to be run inside SOA– Spring Bean can be invoked as service – Spring Bean can have service component injected

Resources• Presentation and demos are on our blog

– http://technology.amis.nl/blog• Contact me at:

lucas.jellema@amis.nl