49
Java Power to the SOA Developer ODTUG Kaleidoscope 2010 Wednesday, 30 th June Clemens Utschig- Utschig Lucas Jellema AMIS, The

Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Embed Size (px)

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.

Citation preview

Page 1: 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

Page 2: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 3: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

From Java, To Java, Run Java

JMS

EJB

JavaApplication

JAX-WSJava Class

ADF-BCADF BC

SDO

JMSJavaApplication

JavaApplication

JavaApplication

EJBADF

Page 4: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 5: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 6: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 7: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Create Composite application, WS interface and Java Interface

Page 8: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Create the (inbound) EJB Binding

Page 9: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Invoking the SOA Composite via the EJB Binding

Page 10: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Client of EJB Binding in action

Page 11: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 12: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 13: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 14: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 15: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 16: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

(outbound) EJB Binding

Page 17: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

The WSDL is created upon wiring to the EJB binding

Page 18: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Run composite with call via outbound EJB binding

Page 19: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 20: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

ADF Faces Web ApplicationPatientAdministration

SOA Suite

EDN

PATIENTS

Application ModulePatientsService

Entity ObjectPatient

View ObjectPatientsVw

(SDO) Web Service

PatientsService

ADF Business

Components

Page 21: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 22: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Expose ADF BC Service Interface

Page 23: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Test SDO enabled Service Interface

Page 24: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Using the ADF-BC Binding Adapter

Page 25: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Create SDO Entity based variable in BPEL process

Page 26: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 27: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 28: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 29: Java power to the SOA developer (ODTUG Kaleidoscope 2010)
Page 30: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Consult Preparation Service

Page 31: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Add translations using Google’s RESTful Translation Service

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

Page 32: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Add embedded Java activity

Page 33: Java power to the SOA developer (ODTUG Kaleidoscope 2010)
Page 34: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Extend with Dutch translations

Page 35: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Extend with Dutch translations

Page 36: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 37: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 38: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

advanced manipulation (enrichment?), complex validation

Page 39: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 40: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 41: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

First Steps

Page 42: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Use Case: Add PDF generation to a composite application

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

Page 43: Java power to the SOA developer (ODTUG Kaleidoscope 2010)
Page 44: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 45: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Second round

Page 46: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Third round

Page 47: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Injecting LogFileWriter & ConsoleLogger

Page 48: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

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

Page 49: Java power to the SOA developer (ODTUG Kaleidoscope 2010)

Resources• Presentation and demos are on our blog

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

[email protected]