Sie sind auf Seite 1von 20

Oracle SOA Suite

Enterprise Service Bus

Oracle Integration Product Management


Oracle ESB
Header Support

Slide 2
ESB Header Support

• Use Cases
– Files, JMS, AQ, MQ, B2B, Apps

• Header Transformation
– Uses XSL Transformations
– XSL variables
– New XPATH Get/Set Header functions
– Minimal GUI Support

• Header Based Routing


– Uses Filter Expressions

Slide 3
One Way Invocation

• Request Header
• Outbound Header

Routing Service

Request Header F X Outbound Header

Propagate

Slide 4
Two Way Request/Reply Invocation

• Inbound Response Header


• Response Header

Routing Service

Response Header X Inbound Response Header

Pass-through

Slide 5
Header Transformation

• Supported using XSLT extension functions


• User can read/get Request headers and Inbound
Response Headers
• User can write/set Outbound headers and Response
Headers
• Namespace for all the extension functions is :
http://www.oracle.com/XSL/Transform/java/oracle.tip
.esb.server.headers.ESBHeaderFunctions

Slide 6
Header Transformation Extension Functions

1. String getRequestHeader(String xpathExpression,String namespaceDecl)

2. void setOutboundHeader(String xpathExpression,String value, String namespaceDecl)

3. String getInboundResponseHeader(String xpathExpression,String namespaceDecl)

4. void setResponseHeader(String xpathExpression,String value, String namespaceDecl)

Where,
xpathExpression : XPath expression to get/set
value : value to be set for the xpathExpression
namespaceDecl : namespace declarations in the form ‘prefix=namespace;’

Slide 7
Header Transformation Example
Example:
To read ‘fileName’ header from an inbound file adapter message

// Declare extension function’s namespace in the XSL file as


<xsl:stylesheet version="1.0“
….
xmlns:ehdr=http://www.oracle.com/XSL/Transform/java/oracle.tip.es
b.server.headers.ESBHeaderFunctions
exclude-result-prefixes=“…”>

// Read ‘fileName’ from the header


<xsl:variable name="GET_INFILENAME"
select="ehdr:getRequestHeader(
'/fhdr:InboundFileHeaderType/fhdr:fileName',
'fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/;’)”
/>

Slide 8
Header Transformation Example
Example:
To write ‘fileName’ header to an outbound file adapter message

// Declare extension function’s namespace in the XSL file as


<xsl:stylesheet version="1.0“
….
xmlns:ehdr=http://www.oracle.com/XSL/Transform/java/oracle.tip.es
b.server.headers.ESBHeaderFunctions
exclude-result-prefixes=“…”>

// Write ‘fileName’ from the header


<xsl:variable name="SET_OUTFILENAME"
select="ehdr:setOutboundHeader('/fhdr:OutboundFileHeaderType/fhdr
:fileName', $GET_INFILENAME,
'fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/;')"/>

Slide 9
Header Based Routing
• Supported using XPath extension functions
• User can add filters using Request headers and Inbound Response Headers
• Syntax is same as that for the current filter expressions.
{ filterExprssion };{ namespaceDeclaration }
• Namespace for all the extension functions is :
http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.E
SBHeaderFunctions

• Following XPath extension functions are added

1. String getRequestHeader(String xpathExpression)


2. String getInboundResponseHeader(String xpathExpression)

Where,
xpathExpression : XPath expression to read the header

Slide 10
Header Based Routing Example

Example:
To check if ‘fileName’ read by inbound file adapter message is Payload.xml

// Check if ‘fileName’ from the header is ‘Payload.xml’


// Filter Expression will look like
{ehdr:getRequestHeader('/fhdr:InboundFileHeaderType/fhdr:fileName‘) ==
‘Payload.xml’};{ namespace ehdr=
http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.E
SBHeaderFunctions namespace
fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/}

Slide 11
Dynamic SOAP Endpoint Example

Example:
To dynamically override the outbound SOAP endpoint, set the
Location header to http://localhost:7777/esb in your XSL as shown
below.

ESB XSL CODE


<xsl:variable name="LocationIn" select="'http://localhost:7777/esb'" />
<xsl:variable name="LocationOut"
select="ehdr:setOutboundHeader('/shdr:ESBHeader/shdr:location',
$LocationIn, 'shdr=http://xmlns.oracle.com/esb;')"/>

This functionality requires SOA/ESB 10.1.3.3 or a 10.1.3.1 patch

Slide 12
Known Limitations

• Set Header() functions support only following types of Xpath expr


– Absolute Path - /Customer/Address/Zip
– Indexing - /Customer/Address[2]/Zip
– if Address[1] is not already present in the target document, it will be created.
– JMS Custom properties supported with the following syntax
• Get “Property[position()=1]/@name”
• Set “Property[@name=&quot;Country&quot;]/@value”
– Get and SetHeader functions used inside XSL must not have opaque inputs/outputs

• Limited SOAP support


– ‘Header’ element will be set as header
– User has to use XPath expressions starting with header element
– eg. ‘/Header/Message/Priority’

• Limited Tooling support

Slide 13
File Header Demo JDeveloper

• File to File
• Filter routes only if input Filename = ‘Mobile.xml’
• Transform propagates filename to output adapter

Slide 14
File Header Demo XPATH Filter

Filter Expression
ehdr:getRequestHeader('/fhdr:InboundFileHeaderType/fhdr:fileName') = 'Mobile.xml'

Slide 15
File Header Demo XSLT
XSL Variables Design View
INFILENAME, OUTFILENAME

Slide 16
File Header Demo XSLT
XSL Variables Source View
INFILENAME, OUTFILENAME


<xsl:variable name="INFILENAME"
select="ehdr:getRequestHeader('/fhdr:InboundFileHeaderType/fhdr:fileName','fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/;')"/>

<xsl:variable name="OUTFILENAME"
select="ehdr:setOutboundHeader('/fhdr:OutboundFileHeaderType/fhdr:fileName', $INFILENAME, 'fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/;')"/>

Slide 17
File Header Demo Runtime

Slide 18
File Header Demo Instructions

1 – Unzip ESBHeader.zip from “training\sampledata” folder to c:\temp


2 – Start JDeveloper
3 – Select existing ESBSamples project
4 - Open “C:\temp\ESBheader\HeaderSupportDemo\HeaderSupportDemo.jpr”
5 – Register with ESB Server
6 – Observe new service metadata in ESB Console under System “TVox”
6 – Copy C:\temp\ESBheader\*.xml files to C:\temp\ESBheader\in
7 – Observe both files deleted but only Mobile.xml in Out dir
8 – View in ESB console Instance data

Note: The C:\temp location is hard coded in both adapters. You can unzip to
another location and then run the file adapter wizards to change the location.

Slide 19
Additional Header Info
Adapter Namespace In Properties Out Properties XPATH Example
JMS http://xmlns.oracle.com/pcbpel/adapter/jms/ jmsAdapterInboundHeader.wsdl jmsAdapterOutboundHeader.wsd ('/jhdr:JMSInboundHeadersAndProper
JMSCorrelationID JMSDestinationName ties/jhdr:JMSInboundHeaders/jhdr:J
JMSDeliveryMode JMSDestinationProperties MSCorrelationID') = 'HIGH'
JMSExpiration JMSCorrelationID
JMSMessageID JMSType
JMSPriority JMSReplyTo
JMSRedelivered
JMSType
JMSTimestamp
JMSReplyTo

File http://xmlns.oracle.com/pcbpel/adapter/file/ fileAdapterInboundHeader.wsdl fileAdapterOutboundHeader.wsdl ('/fhdr:InboundFileHeaderType/fhdr:


filename Filename fileName') = 'Mobile.xml'
directory

AQ http://xmlns.oracle.com/pcbpel/adapter/aq/in aqAdapterInboundHeader.wsdl aqAdapterOutboundHeader.wsdl


bound/ aqAdapterInboundHeader.xsd aqAdapterOutboundHeader.xsd
MessageId Priority
Priority Delay
Correlation Expiration
Attempts Correlation
EnqueueTime RecipientList
OrigMessageId ExceptionQueue

SOAP http://schemas.xmlsoap.org/soap/envelope/ Custom Custom ('/soap:Header/ns1:country') = ‘US‘


Location (‘/shdr:ESBHeader/shdr:location’)

Other adapter examples: See BPEL Samples and Adapter OTN Pages

Slide 20

Das könnte Ihnen auch gefallen