Sunday, January 29, 2012

Oracle Service Bus: How to create Proxy and Business Services Part 2.3: Tutorial; Create Business Services.

Oracle Service Bus: How to create Proxy and Business Services Part 2.3: Tutorial; Create Business Services.

Create the Business Services
In the routing a loan scenario, when the interest rate requested on a loan application is greater than or equal to 5%, then the loan application is routed to the normal loan processing service for approval. If the interest rate requested on a loan application is less than 5%, then the loan application must be approved by a manager, therefore it is routed to a manager approval service.

Create the NormalLoan Business Service
1. In the Oracle Service Bus Console Change Center click Create to create a
new session.
2. In the Project Explorer, select the BusinessService folder.
3. In the Select Resource Type list, select Business Service.

4. Enter a name for the service. In this case, enter NormalLoan.
5. For Service Type, select WSDL Web Service, then click Browse. Select the
WSDL and port on which to base the business service:
a. In the WSDL Browser, select the normalLoan WSDL
b. Select the port (helloPort) for the WSDL.
c. Click Submit.
The text field for the WSDL port service type is populated with the value
selected on the Create a Business Service - General Configuration page.
6. Click Next.

7. Accept the default protocol, http.
8. Select none for the Load Balancing Algorithm, since load balancing is
relevant only when a service specifies multiple end points.
When you specify multiple end points and a load balancing algorithm, if one
end point is overloaded or not available at run time, the message can be sent
to the next service in the list of end point URIs. In this case, there is only one
service, therefore accepting the default behavior or selecting none does not
affect the behavior of the proxy service at run time.
9. The End Point URI of the business service is the endpoint URI on the server
on which the service is deployed. Ensure that the pre-populated value for the
End point URI in the “Existing URIs” field is
The host and port values specified for <host:port> represent the machine
and port on which your Oracle Service Bus server is running.
10. Accept the default settings for the remaining options on the page and click

11. In the Create a Business Service-HTTP Transport Configuration page, accept
the default settings on this page, then click Next.
12. In the Create a Business Service-SOAP Binding Configuration page, accept
the default settings and click Next.
13. In the Message Handling page, click Next.
The Create a Business Service-Summary page is displayed. You can now
check if all the settings of the business service have been implemented
14. Click Save to accept the configuration settings.
To turn on monitoring for the NormalLoan business service, click the
NormalLoan business service in the Resources pane. The View a Business
Service page is displayed. The Operational Settings tab on this page has
options to enable monitoring for the business service.
To enable monitoring:
a. Click the Operational Settings tab.
b. Select the Enabled check box for the Monitoring field.
c. Choose an aggregation interval for the service. The aggregation
interval is the period over which aggregated statistics related to the
service are computed for display in the Oracle Service Bus Console
dashboard. You can also accept the default value for the Aggregation
Interval, which is set to five minutes.
d. Click Update.
e. Activate the session.
You have completed the configuration of the NormalLoan business service on Oracle
Service Bus Console.

Create the ManagerLoanReview Business Service
To create the business service to which a loan application is routed when the
interest rate requested in that loan application is less than 5%.
Follow the same tasks as described in the previous section on creating the
ManagerLoanReview business service, but use the configuration parameters in the
following table.

You have created two business services (NormalLoan and ManagerLoanReview), a
proxy service (LoanGateway1) and two WSDL resources (normalLoan and
ManagerApprovalService) that are the resources required for this tutorial.


  1. Hi Harvinder

    Thanks for the blog.
    I need a suggestion from you. I have an underlying service that has 2 ports, each pointing to a different URL. I have to create an OSB Service to call this(basically, my OSB acts just as a pass-through service)
    How can I achieve this? How can I create a proxy & Business service based on a wsdl that has 2 ports? Can it be done in a single OSB Project?
    Appreciate your response!


  2. Ravi.. at at given time the requesting service will call only one port. In the Schema of the WSDL of your proxy service add an element that will determine which port needs to be called. In the Routing, cal the port that needs to be requested based on the value of the element.

  3. How can I call this service from a PL/SQL package ?

  4. Please find the sample skeleton code to get you started
    PROCEDURE p_soap_request(p_username IN VARCHAR2, p_password IN VARCHAR2, p_proxy IN VARCHAR2) IS
    soap_request VARCHAR2(30000);
    soap_respond CLOB;
    http_req utl_http.req;
    http_resp utl_http.resp;
    resp XMLType;
    soap_err exception;
    v_code VARCHAR2(200);
    v_msg VARCHAR2(1800);
    v_len number;
    v_txt Varchar2(32767);
    -- Define the SOAP request according the the definition of the web service being called
    soap_request:= ''||
    ' '||
    ' '||
    ' '||p_username||''||
    ' '||p_password||''||
    ' '||
    ' '||
    http_req:= utl_http.begin_request
    ( ''
    , 'POST'
    , 'HTTP/1.1'
    utl_http.set_header(http_req, 'Content-Type', 'text/xml');
    utl_http.set_header(http_req, 'Content-Length', length(soap_request));
    utl_http.set_header(http_req, 'Download', ''); -- header requirements of particular web service
    utl_http.write_text(http_req, soap_request);
    http_resp:= utl_http.get_response(http_req);
    utl_http.get_header_by_name(http_resp, 'Content-Length', v_len, 1); -- Obtain the length of the response
    FOR i in 1..CEIL(v_len/32767) -- obtain response in 32K blocks just in case it is greater than 32K
    utl_http.read_text(http_resp, v_txt, case when i < CEIL(v_len/32767) then 32767 else mod(v_len,32767) end);
    soap_respond := soap_respond || v_txt; -- build up CLOB
    resp:= XMLType.createXML(soap_respond); -- Convert CLOB to XMLTYPE


SOA Cloud 12c GIT Repository

When a project is created, you can choose to initialize the project with one project Git repository for the project. A Maven repository is a...