0% found this document useful (0 votes)
2 views4 pages

03 Code Reference

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

03 Code Reference

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SOA Code & Artifacts Reference

Oracle SOA — Code & Artifacts Reference


Document 3 of 4
Read each snippet until you can explain every line. Interviewers may show you code and ask 'what does this do?'

You don't need to write these from memory, but you must be able to read any of them aloud and explain it.
Each example below has a plain-English explanation underneath. The goal: if they put an XSLT or a fault-policy
file on screen, you narrate it confidently.

1. XSLT Transformation
Maps a source order to a canonical order, with a constant, a conditional, and a loop — the three things every
mapping needs.
<xsl:stylesheet version="2.0"
xmlns:xsl="[Link]
xmlns:src="[Link]
xmlns:can="[Link]

<xsl:template match="/">
<can:Order>
<!-- constant / system value -->
<can:Source>PARTNER_A</can:Source>

<!-- simple field map -->


<can:OrderId>
<xsl:value-of select="/src:Order/src:Id"/>
</can:OrderId>

<!-- conditional -->


<can:Priority>
<xsl:choose>
<xsl:when test="/src:Order/src:Amount &gt; 10000">HIGH</xsl:when>
<xsl:otherwise>NORMAL</xsl:otherwise>
</xsl:choose>
</can:Priority>

<!-- loop over line items -->


<can:Lines>
<xsl:for-each select="/src:Order/src:Item">
<can:Line>
<can:Sku><xsl:value-of select="src:Sku"/></can:Sku>
<can:Qty><xsl:value-of select="src:Quantity"/></can:Qty>
</can:Line>
</xsl:for-each>
</can:Lines>
</can:Order>
</xsl:template>
</xsl:stylesheet>

Explain it as: “It matches the root, builds the canonical Order, sets a constant source, maps the ID directly,
derives Priority with a choose/when conditional on Amount, then loops over each source Item with for-each to
build canonical Lines.”

Page 1
SOA Code & Artifacts Reference

2. XQuery (OSB-style transformation)


The same idea in XQuery — this is what you write in an OSB pipeline. Note FLWOR (for-let-where-order-return).
xquery version "1.0";
declare namespace src = "[Link]
declare namespace can = "[Link]

declare variable $order as element() external;

<can:Order>
<can:OrderId>{ data($order/src:Id) }</can:OrderId>
<can:Lines>
{
for $i in $order/src:Item
where xs:decimal($i/src:Quantity) > 0
return
<can:Line>
<can:Sku>{ data($i/src:Sku) }</can:Sku>
<can:Qty>{ data($i/src:Quantity) }</can:Qty>
</can:Line>
}
</can:Lines>
</can:Order>

Explain it as: “It takes the order element as input, builds the canonical structure, and uses a FLWOR expression
— for each Item where quantity > 0, return a canonical Line. XQuery is the default transformation language in
OSB.”

3. XPath — common expressions to recognize


/Order/Customer/Name (: absolute path :)
//Item (: any Item, any depth :)
/Order/Item[Quantity > 5] (: predicate / filter :)
/Order/Item[1] (: first item (1-indexed) :)
count(/Order/Item) (: aggregate :)
sum(/Order/Item/LineTotal)
concat(First, ' ', Last) (: string function :)
/Order/Item[last()] (: last item :)
normalize-space(/Order/Notes) (: trim/collapse spaces :)
Used inside BPEL Assign activities, Mediator filters, and conditions. Remember XPath is 1-indexed, not 0.

4. Fault Policy ([Link])


Declarative production fault handling — retry transient faults, escalate the rest to human intervention. This is a
senior must-know artifact.
<faultPolicies xmlns="[Link]
<faultPolicy version="2.0" id="OrderFaultPolicy">
<Conditions>
<faultName xmlns:bpelx="[Link] name="bpelx:remoteFault">
<condition>
<action ref="retry-then-human"/>

Page 2
SOA Code & Artifacts Reference

</condition>
</faultName>
</Conditions>
<Actions>
<Action id="retry-then-human">
<retry>
<retryCount>3</retryCount>
<retryInterval>30</retryInterval>
<exponentialBackoff/>
<retryFailureAction ref="human"/>
</retry>
</Action>
<Action id="human">
<humanIntervention/>
</Action>
</Actions>
</faultPolicy>
</faultPolicies>

Explain it as: “On a remoteFault — a transient system fault — retry 3 times, 30 seconds apart with exponential
backoff. If it still fails, move the instance to human intervention so support can recover it in EM. Nothing is lost.”
Then mention [Link] binds this policy to the composite.

5. PL/SQL — procedure with bulk processing & exception handling


Reflects your CIPC migration work — set-based bulk processing, not row-by-row.
CREATE OR REPLACE PROCEDURE process_orders (p_batch_id IN NUMBER) IS
TYPE t_orders IS TABLE OF orders%ROWTYPE;
l_orders t_orders;
BEGIN
SELECT * BULK COLLECT INTO l_orders
FROM orders
WHERE batch_id = p_batch_id
AND status = 'NEW';

FORALL i IN 1 .. l_orders.COUNT
UPDATE orders
SET status = 'PROCESSED', processed_dt = SYSDATE
WHERE order_id = l_orders(i).order_id;

COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL; -- nothing to process
WHEN OTHERS THEN
ROLLBACK;
log_error(p_batch_id, SQLERRM);
RAISE;
END process_orders;

Explain it as: “BULK COLLECT reads the batch into a collection in one round trip, FORALL applies the updates in a
single context switch instead of row-by-row — that's the ~set-based performance win. The EXCEPTION block
rolls back and logs on failure, then re-raises so the caller knows.”

Page 3
SOA Code & Artifacts Reference

6. DB Adapter — logical-delete polling concept


You won't write this by hand (the wizard generates it), but explain the strategy:
• The adapter polls SELECT ... WHERE status = 'NEW' on an interval.
• After reading, it flips the row to PROCESSED (the logical delete column) so it's not picked up again.
• MaxRaiseSize controls how many rows become one message; PollingInterval controls frequency;
a Distributed Polling option with SELECT ... FOR UPDATE SKIP LOCKED lets multiple nodes
poll the same table safely in a cluster.

Senior detail: Mentioning SKIP LOCKED for distributed polling in a clustered SOA environment is a strong signal
you've run this in production, not just dev.

7. WLST — automation snippet


# connect and deploy a SOA composite via WLST
connect('weblogic','password','t3://soahost:7001')

sca_deployComposite('t3://soahost:8001',
'/deploy/OrderProcess_rev1.[Link]',
overwrite='true',
forceDefault='true')

disconnect()
WLST (Jython) makes deployments and admin repeatable across QA/UAT/Prod — the environment promotion
you supported. Also used to create data sources, JMS queues, and connection factories.

If you can read these seven artifacts aloud and explain them line by line, you'll handle any 'what does this
code do?' moment with ease.

Page 4

You might also like