Oracle Service Bus projects¶
The osb output generates an Oracle Service Bus 12c (12.2.1.x) project that imports into JDeveloper and deploys like a hand-built one.
Project structure¶
For a project TravelService with three exposed services and two backends:
TravelService/
├── ProxyServices/ PersonInformation_PS.proxy, TravelServices_PS.proxy, PersonTravel_PS.proxy
├── Pipelines/ BasePipelineSoap12.ptx and one {Proxy}_PL.pipeline per proxy
├── BusinessServices/ PersonTravel_BS.bix, TravelServices_BS.bix
├── Resources/
│ ├── WSDLs/ one WSDL per proxy and per business service
│ ├── Schemas/ CommonSchema.xsd, proxy schemas, business service schemas
│ ├── XSLs/ {Operation}Request.xsl and {Operation}Response.xsl
│ └── *.wadl WADLs of REST proxies and REST business services
└── Docs/ documentation and test artifacts
| Artifact | One per | Produced by |
|---|---|---|
Proxy service ({Proxy}_PS.proxy) |
exposed service | Template (REST or SOAP) |
Pipeline ({Proxy}_PL.pipeline) |
exposed service | Template with route fragments |
Business service ({Name}.bix) |
backend | Template (REST or SOAP) |
| WSDL, XSD, WADL | proxy and business service | Deterministic builders |
| Request and response XSLT | operation contract | Deterministic builder |
CommonSchema.xsd, BasePipelineSoap12.ptx |
project | Template folder |
The templates live in template/{project_name}/. Change them there (or point TEMPLATE_DIR at your own copy) to adapt the generated projects to your standards; no code change is needed.
Pipelines and routing¶
Every pipeline is based on BasePipelineSoap12.ptx, which holds the shared request stage, the error handler (backend HTTP 400, 401 and 500 become ServiceFault_* SOAP faults) and a route node with a placeholder. The generated pipeline fills that placeholder.
Direct route. When all operations of an exposed service belong to one business service, the route node contains a single route to it.
Routing table. When the operations belong to several business services, the route node contains a routing table on the requested operation:
<con1:routingTable>
<con1:expression><con2:xqueryText>true()</con2:xqueryText></con1:expression>
<con1:case id="…">
<con1:operator>equals</con1:operator>
<con1:value>($operation = ("GetPersonTravelInfo","GetPersonEntryExitDetails"))</con1:value>
<con1:route>… PersonTravel_BS …</con1:route>
</con1:case>
<con1:defaultCase>
<con1:route>… TravelServices_BS …</con1:route>
</con1:defaultCase>
</con1:routingTable>
How the table is built:
- Operations are grouped by the business service that serves them.
- The business service with the most operations becomes the default case. On a tie, the one used first in the proxy wins.
- Every other business service becomes an explicit case, in ascending order of operation count. A case matches when
$operationis one of its operations.
For example, with five operations on TravelServices_BS, two on PersonInformation_BS and one on Audit_BS, the table has a case for Audit_BS, then a case for PersonInformation_BS, and the default route to TravelServices_BS.
Each route, direct or in a table:
- passes the operation through to the business service (
operation passThrough="true"); - transforms the request and the response with the operation's XSLT, chosen at run time with
fn:concat("{Project}/Resources/XSLs/", $operation, "Request"); - forwards the HTTP headers the backend expects: the header parameters and credential headers (for example
Authorizationfor HTTP Basic) declared for that route's operations in the source document, plus the standardX-*tracing headers.
Composing services¶
An operation can be exposed by several services, for example a new PersonTravel service that offers operations already exposed by PersonInformation and TravelServices. Assign the operations in the Designer with Add to proxy, or ask in the chat ("add Search and GetPersonTravelInfo to a new proxy PersonTravel and keep them where they are").
Which schema defines an operation¶
The first proxy in the plan that lists an operation is its home. The home proxy's schema (Resources/Schemas/{Proxy}.xsd) defines the operation's request and response elements, and the shared XSLT files map them to the business service.
Another proxy that exposes the operation then gets one of two contracts. The choice depends on the operation's actual schema dependencies:
| Situation | Contract | XSLT |
|---|---|---|
| The operations it takes from the home schema need every definition in that schema (elements, complex and simple types) | The home schema is reused: the proxy WSDL imports it unchanged, in its own namespace | The home XSLT files are reused, so nothing is duplicated |
| They need only part of the home schema | A reduced copy: only the definitions those operations need (their elements and every type they reference, transitively) are added to the proxy's own schema, in the proxy's namespace | New XSLT files {Proxy}_{Operation}Request.xsl / Response.xsl, because the contract is new |
Unrelated structures of the home schema are never exposed. A proxy whose operations all reuse other schemas has no schema of its own; its WSDL imports the schemas it uses:
<xsd:import namespace="http://www.sample/MOIPersonTravel" schemaLocation="../Schemas/PersonInformation.xsd"/>
<xsd:import namespace="http://www.moi.gov.ae/TravelServices" schemaLocation="../Schemas/TravelServices.xsd"/>
<xsd:import namespace="http://www.moi.gov.ae/common" schemaLocation="../Schemas/CommonSchema.xsd"/>
When one route mixes reused and proxy-specific XSLT files, the pipeline chooses the file name prefix per operation inside the XSLT expression.
Control the home of an operation
Order matters: keep the existing services first in the plan and add combining services after them, so the combining service reuses their contracts.
References between files¶
All references are relative to the file that contains them:
| From | To | Reference |
|---|---|---|
WSDL in Resources/WSDLs/ |
schema | ../Schemas/{Name}.xsd |
WADL in Resources/ |
schema | Schemas/{Name}.xsd |
XSLT in Resources/XSLs/ (mapper metadata) |
schema | ../Schemas/{Name}.xsd |
Schema in Resources/Schemas/ |
common schema | CommonSchema.xsd |
| Proxy, pipeline, business service | other resources | {Project}/Resources/… resource references |
The final validation of each run resolves every one of these references and reports anything broken as BROKEN_REFERENCE, BROKEN_BINDING or ROUTING_MISMATCH.
Defaults¶
| Item | Default |
|---|---|
| Exposed services | One named after the project; one per source document when there are several |
| Business services | {Project}_BS for one source document; {Document}_BS per document otherwise |
| Proxy endpoint | /ProxyServices/{Proxy} |
| Namespaces | The plan namespace for a single proxy; {namespace}/{Proxy} with several; {namespace}_BS for the default business service |
| Backend URI | http://localhost/{Name} (SOAP) or http://localhost:8001/{Name} (REST); set the real one per business service |
All of these can be changed in the plan.