Friday, April 20, 2012

OSB Demo Sample developed from scratch

Proof of Concept: OSB Demonstration
This demonstrates the basic OSB sample. You should have already installed OSB and weblogic on your system.

Refer my previous post for installing OSB and weblogic

For complete document with screen shot you can refer google doc

For OSB demo we require the following :
1. Webservice (with WSDL,XSD)
2. Business Service which is developed using above webservice
3. Proxy Service which invokes the above Business service
Let us first construct the WebService
Step A : Construction of Webservice
1)Double click on OEPE which is installed in FMW_HOME/OEPE folder. Choose File->New->Web Service Project as shown below

2)Give the project name as Sample_WS where WS stands for WebService project. If Target run time is not defined then create the new one buy clicking on new runtime and select the version. Here 10.3.6 is selected as weblogic version is 10.3.6

3)Click the Finish button and the Target runtime is visible as shown below

4)Click on Next and follow as shown below

5)change the context root to business/sample
6)Click on Yes” for the below dialogue. Let it be Java EE perspective
7)The webservice Project is created as shown below

8)Right click on src folder and create the package com.osb.sample as shown below

9)Now right click on the package and select weblogic web service and give the name as Sample

10)The following code is generated as shown below where you can put your own logic.
Here we have added three methods.
String sayHello(String s)
Int addNum(int a, int b)
Int subNum(int a, int b)

The class is as shown below

import javax.jws.*;

public class Sample {

public String sayHello(String s) {
return "Hello"+s;

public int addNum(int a,int b) {
return a+b;

public int subNum(int a , int b) {
return a+b;

Step B Configuring the Server and running the webservice
1)Add the server if not added as shown below
Click File->New->other->Server

2)You should be able to see the message as shown above. “Started”
3)Now we need to run the webservice. Right click on the Sample_WS project and click run and select the server added.

4)Access the WSDL through URL

Step C: Create OSB configuration project
Now webservice Is ready. From now onwards the real OSB work starts
we need to create OSB configuration project. .It represents the configuration information associated with an OSB domain (a group of servers, all similarly configured and providing identical functionality).
1)FileNewotherOracle service bus Configuration Project

2)You can keep the default name or if you want can give some meaningful name

Now the configuration is ready hence we need to proceed further to create OSB Project

Step D: Creating Sample OSB project
1)file->Oracle service Bus Project

2)Ensure that OSB Configuration 1 is selected which was created earlier. Give the name which has suffix as _SB just to denote it is Service Bus project as shown below

3)The Sample_SB(Sample Service Bus) project is created as shown below

Step E : Developing Business Service
The next step is to develop business Service which is called by Proxy service
To develop business service we require WSDL of the service which was created earlier.
1)To generate the WSDL , go to the Sample_WS project, under src go to , right click and select weblogic webservices and select Generate WSDL as shown below

2)Service is created in the same package as shown below

3)Copy the SampleService.wsdl and the xsd into the Sample_SB project

4)Notice the following in WSDL

Replace the location


It should look as shown below

5)Now we can develop business service as shown below as we have WSDL file for the same. Right-click the Sample_SB project in the Project Explorer window and select New -> Business Service from the pop-up menu

6)make sure that the Sample_SB project is selected, and then set the file name field to SampleBiz where Biz stands for Business

7)Busniess service is created as shown below
8)The General Configuration settings needs to be done as shown below

9)Select the WSDL and port (SamplePort) as shown below

10)Select Yes when we get the following dialog

Note:If you select NO then under transport tab you get the error

Step F: Creating the proxy service

Once the Business Service is ready next is to create Proxy Service.The easiest way to create proxy service is to “Right click “ on SampleBiz, select the Oracle Service Bus and select generate proxy which will automatically create the proxy service.
The other way of doing is given below but you need to add more steps
1)Right click project explorer->Proxy Service

2)Select Sample_SB to get rid of the above error. Give the name of proxy as “sample”

3)Do the General configuration as shown below

4)Do the transport configuration as shown below
Change the end point to /osb/Sample

5)Click on the Message flow tab as shown below

6)Add the routing so that it gets routed to SampleBiz. Drag Route from Nodes from RHS.

7)Click on Routing from route Actions. After adding Routing it looks as shown below

8)Click on Routing on LHS and browse the Service and point to SampleBiz as shown below

Step G: Deploy project
1)Go the server tabs, right click on the server tab, click “Add and Remove”

2)Add OSB_Configuration , Sample_ws, Sample_SB to the server
Note: The Sample_SB project is part of the OSB_Configuration, so you do not need to add it explicitly. Just click the Finish button, and OEPE will deploy the projects.

3)After clicking finish the services would be deployed

4)Verify the service
Login to localhost:7001/sbconsole weblogic/welcome1 , notice the proxy service , business service are deployed

5)When you try to launch test console to test the proxy service through “Actions” as shown in above figure, you may get error as "Test Console" service is not running. Contact administrator to start this service.

Note: Test console will work only when OSB server is up and running (Along with admin server); and all deployments on OSB server are in active state. Make sure to check this by logging to em. If osb server is not up then start the server

6)Now start the OSB_server
startManageWeblogic.cmd osb_server1 from the location
E:\ oracle\fmw11116\user_projects\domains\osb_domain\bin
Check through EM if it has been started
7)testing the proxy service
Now launch the TestConsole as described previously and give the input . Select the addNum operation from the available operations. Given the input as 3,3 and you should get the ouput as 6.

8)Analyzing more details
If you scroll down in the same test console , you could see the invocation trace. Notice thei incoming request, also notice it is getting routed to sample business service called samplebiz.


Anonymous said...

You really saved me,excellent steps and post

Anonymous said...

Nice Tutorial
please write tutorial involing BPEL, OSB, WS ...and explain why we need BPEL in the scenario. Looking for the post

malini ecorp said... provides J2EE in hyderabad with best faculties on real time projects. We give the best online trainingamong the J2EE in Hyderabad. Classroom Training in Hyderabad India

Amani Phoenix said...

Yeah its a good article. According to you what we project managers do is communicating. And a lot of this communication is done during project meetings. It can sometimes feel like you are running from one meeting to another and that your time is often wasted. Meetings don’t start on time, the issues aren’t dealt with, there is no agenda, there is no focus, nobody assigns any follow ups or tasks and of course then they also don’t end on time. An efficient project manager is required for the good management of a project. I think a project manager should PMP certified. Looking forwards to apply what I learned in PMP classes in my company.