Quick Start

It only takes 1 hour and a few simple steps! Do it now!

STEP 1. Download GenericParallel
STEP 2. Import Into OEPE (Eclipse)
STEP 3. Prepare Services To Call
STEP 4. Make Entry Proxy
STEP 5. Make List Of Requests
STEP 6. Route To GenericParallel
STEP 7. Make Composite Response
STEP 8. Enjoy!

Please note: this guide project is available for your reference as an OSB project within the distribution ZIP under name QuickStart.jar.


STEP 1. Download GenericParallel

Extracted GenericParallel distribution

Extracted GenericParallel distribution

Download the distribution ZIP and extract it into a temporal working directory.


STEP 2. Import Into OEPE (Eclipse)

OSB project before importing GenericParallel

OSB project before importing GenericParallel

In Eclipse/OEPE, open Oracle Service Bus perspective.

Open Project Explorer if it is not opened by default.

Importing JAR

Importing JAR

Right-click on OSB configuration project (QuickStart in this case).

Hover the mouse over Import menu item, and in the opened sub-menu click Oracle Service Bus – Configuration Jar.

Selecting JAR file

Selecting JAR file

Select GenericParallel-x.x.x.jar from the directory where you’ve extracted the ZIP into.

Click Next.

Completing importing JAR file

Completing importing JAR file

Make no changes to the Preserve… checkboxes.

Click Finish to complete the import.

Import is completed

Import is completed

Import is completed.

GenericParallel is visible in the list of projects and ready to be used.


STEP 3. Prepare Services To Call

Services to call

Services to call

If you haven’t done that yet, make the services GenericParallel will be calling.

GenericParallel can call OSB Business and Proxy services.

In the example below we’re going to call Internet, Mobile and TV account proxy services.

For QuickStart project those services are mocks, i.e. do not call any real backends.


STEP 4. Make Entry Proxy

Entry Proxy

Entry Proxy

Create an entry OSB proxy which will be called by the consumers.

The entry proxy will use GenericParallel to call three account proxy services.

In the example below the proxy is called CompositeAccount.

Proxy Overview

Proxy Overview

In the request pipeline build the GPS request containing 3 requests to Internet, Mobile and Television account services.
(see Step 5 below)

Route the proxy to GenericParallel local proxy located at GenericParallel/GenericParallel path, with operation DoInParallel.
(see Step 6 below)

In the response pipeline build the CompositeAccount response out of 3 separate account services responses.
(see Step 7 below)


STEP 5. Make List Of Requests

Let’s assume the request to the CompositeAccount looks like this

<AccountRequest>
  <UniversalAccountNo>12345</UniversalAccountNo>
</AccountRequest>

In the request pipeline of CompositeAccount proxy replace the Body content with the result of an XQuery that builds a GenericParallel request to call all three account services.

<typ:GPS xmlns:typ="http://genericparallel/types">
  <typ:Requests>

   <typ:Request GPSTarget="AccountServices/Backends/InternetAccount">
     <InternetAccountRequest>
       <AccountNo>{$body/AccountRequest/UniversalAccountNo/text()}</AccountNo>
     </InternetAccountRequest> 
   </typ:Request> 

   <typ:Request GPSTarget="AccountServices/Backends/MobileAccount"> 
     <MobileAccountRequest> 
       <AccountNo>{$body/AccountRequest/UniversalAccountNo/text()}</AccountNo> 
     </MobileAccountRequest> 
   </typ:Request> 

   <typ:Request GPSTarget="AccountServices/Backends/TelevisionAccount"> 
     <TVAccountRequest> 
       <AccountNo>{$body/AccountRequest/UniversalAccountNo/text()}</AccountNo> 
     </TVAccountRequest> 
   </typ:Request> 
   
  </typ:Requests> 
</typ:GPS>

In the example above each <Request/> section contains one request to a backend service. It is routed to the appropriate service using GPSTarget attribute of the Request element.

The content under Request element is the body of the request as it would be provided under soap:Body element in a SOAP call.

All three requests are populated with the account number passed in the composite AccountRequest.


STEP 6. Route To GenericParallel

Route to GenericParallel

Route to GenericParallel

In our example, GenericParallel is called via a Route node.

Service Callout or Publish would work too, of course.


STEP 7. Make Composite Response

GenericParallel calls all three backend services (concurrently) and returns us a list of responses.

<types:GPSResponse xmlns:types="http://genericparallel/types">
  <types:Responses>

    <types:Response GPSIndex="1" GPSBatchIndex="1">
      <soap-env:Envelope>
        <soap-env:Body>
          <InternetAccountResponse>
          <AccountId>b123456</AccountId>
          <UsageGigabytes>24</UsageGigabytes>
          <DownloadSpeed>30</DownloadSpeed>
          <UploadSpeed>8</UploadSpeed>
          </InternetAccountResponse>
        </soap-env:Body>
      </soap-env:Envelope>
    </types:Response>

    <types:Response GPSIndex="2" GPSBatchIndex="1">
      <soap-env:Envelope>
        <soap-env:Body>
          <MobileAccountResponse>
          <AccountId>mob33456</AccountId>
          <UsageMinutes>417</UsageMinutes>
          <UsageMegabytes>124</UsageMegabytes>
          </MobileAccountResponse>
        </soap-env:Body>
      </soap-env:Envelope>
    </types:Response>

    <types:Response GPSIndex="3" GPSBatchIndex="1">
      <soap-env:Envelope>
        <soap-env:Body>
          <TVAccountResponse>
          <AccountId>tvzaxb1t</AccountId>
          <Packages>
            <Package>1</Package>
            <Package>24</Package>
            <Package>31</Package>
          </Packages>
          </TVAccountResponse>
        </soap-env:Body>
      </soap-env:Envelope>
    </types:Response>

  </types:Responses>
</types:GPSResponse>

Convert it into composite AccountResponse with XQuery and replace the Body content with the result.

<AccountResponse xmlns:gps="http://genericparallel/types">
	<Internet>
		{$body//gps:Response[1]/soap-env:Envelope/soap-env:Body/InternetAccountResponse/*}
	</Internet>

	<Mobile>
		{$body//gps:Response[2]/soap-env:Envelope/soap-env:Body/MobileAccountResponse/*}	
	</Mobile>

	<TV>
		{$body//gps:Response[3]/soap-env:Envelope/soap-env:Body/TVAccountResponse/*}	
	</TV>
</AccountResponse>

Note that the responses’ order is matching the order of requests, so we can use Response[1] notation.

Client then gets the composite response like the one below:

<AccountResponse>
	<Internet>
		<AccountId>b123456</AccountId>
		<UsageGigabytes>24</UsageGigabytes>
		<DownloadSpeed>30</DownloadSpeed>
		<UploadSpeed>8</UploadSpeed>
	</Internet>
	<Mobile>
		<AccountId>mob33456</AccountId>
		<UsageMinutes>417</UsageMinutes>
		<UsageMegabytes>124</UsageMegabytes>
	</Mobile>
	<TV>
		<AccountId>tvzaxb1t</AccountId>
		<Packages>
			<Package>1</Package>
			<Package>24</Package>
			<Package>31</Package>
		</Packages>
	</TV>
</AccountResponse>

STEP 8. Enjoy!

You’re done, and it all took less than an hour!

6 comments on “Quick Start
  1. Mohammed says:

    Hi Vladimir Dyuzhev,

    Do it works for RESTful webservice with JSON as payload.
    Do you have example of REST webservices called in parallel as like SOAP webservices.

    Thanks,
    Mohammed

  2. Ashwaq says:

    Could you please provide a working sample that can be easily modified and used. So json/xml conversion happens dynamically for all rest calls right. Could you please elaborate internal structure and working conditions required to run a new rest service calls using sample code.

    • Vlad Dyuzhev says:

      Hello, Ashwaq.

      I have created a short into how to call REST service with GenericParallel here.

      To your questions, no, JSON conversion is not happening. The payload is preserved and passed to the backend as is. The XML GPSRequest/Request wrappers are just to carry the non-XML payload through split-join which doesn’t support non-XML on its own.

      All you need to call a REST service in parallel is to have a business service pointing to that REST service, and provide GenericParallel with the payload (JSON or otherwise) and REST properties (relative URI, HTTP method, content-type, …).

Leave a Reply

Your email address will not be published. Required fields are marked *

*