This post is meant to explain the few steps you need to take to start with Oracle Service Bus (OSB) development on a Windows 7 laptop. The OSB version used is 11g, although these steps are also suitable for OSB 10gR3 and Aqualogic Service Bus (ALSB) as well.
There are as many ways of organizing a project as there are people, this is the way I have chosen and this by no means is meant as “the way to go“. It is merely meant as a guideline, (so please do adapt where you find it more suitable for your needs)
(You can find the installation instructions for an OSB 11g development environment in this blog post)
There are two OSB projects which you can create when you open the Oracle Enterprise Pack for Eclipse (OEPE):
- Oracle Service Bus Project
- Oracle Service Bus Configuration Project
An OSB Project contains the actual project which you will create. These are often functionally bound and represent a hierarchical structure similar to the structure on your hard disk.
An OSB Configuration Project represents one domain on which you will deploy your projects. These Configuration Projects contain common settings (like a pointer to an SMTP server)
Create an OSB Configuration Project
The first step in a every new OSB Workspace is to create a new configuration project. Later on when you create OSB projects you need to choose the Configuration Project to which they will belong.
Side note: OSB Configuration Projects can be used as pointers to a OSB Domain (or a local domain)
Within Eclipse, right click the empty space in the Project Explorer and choose “New” and then “Oracle Service Bus Configuration Project”. For now we will not use the advanced functions so name your Configuration project to a name suitable for you (for me that mostly means “OSB Configuration”) and press “Finish”
In a new Workspace you will get the question if you would like to switch to the “Oracle Service Bus perspective”, choose “Yes”.
The above steps are the same for every project. I keep my workspaces aligned with the domains to which I deploy.
This means a new workspace for each domain, I often work with common schema’s and services (e.g. loggers / mailers) which I place in a separate project. Although I do re-use a lot of services, I found it better to keep this lean and not to tightly coupled so I create a new Common Services project for each domain instead of creating ONE Project to rule them all.
Create an OSB Project
This paragraph will focus on creating an OSB Project and will contain a sample service.
Right click the empty space in the “Project Explorer” and choose “New” and then “Oracle Service Bus Project”
For the start of every new project you will create the following structure:
- Project name (In this case “OSB Sample Project”)
- Business Service
- Proxy Service
This leads to this view:
This is the basis you need for creating Oracle Service Bus services. I will expand in further detail in later posts.
Create a local development OSB domain
If you do not have a development environment available or prefer to test your service locally you can also create a OSB domain on your local machine. The next paragraph leads you through the creation of a new OSB domain via Eclipse.
We will use the “Configuration Wizard” which will let us create a fresh new local Weblogic domain on our computer.
Press “Start” / the Windows button and enter “Configuration Wizard” which will show the start menu entry in the OSB menu folder:
If all went well, you will be presented with this choice:
Choose “Create a new Weblogic domain” and click “Next” to continue to the product selection:
Only select “Oracle Service Bus for developers – 22.214.171.124 [Oracle_OSB1]”, this will automatically select the dependencies as well. Click “Next” to continue to the Domain name and location screen:
Tip: I tend to use a domain name which indicates that I am working on my own machine as well as states the product and version which is deployed on the Weblogic server. The domain name is quite visible in the web console and this way I’m sure I’m working on the correct domain.
Enter the domain name you wish and press “Next” to continue to the admin user name and password screens:
Since 11g the password is bound to rules which prohibit you from choosing a really simple password. So with this added difficulty make sure you pick one which you will remember!
When you’re done, click “Next” on every screen until you get to the configuration summary.
The configuration is done when you select “Create”, your domain will then be created, after which you will be presented with this summary:
Click “Done” to exit the configuration wizard. We will not start the Admin server yet.
We can now continue to configuring Eclipse to use this domain.
Add our local OSB domain to Eclipse
This paragraph explains how to configure an OSB domain in Eclipse. It is possible to configure a remote (DEV) domain here which is running on another server. I would advise to only configure local domains within your Eclipse, a DEV environment is often shared among colleagues and you might overwrite or tamper with your fellow colleague his or her services without knowing it.
As a guideline: Use the DEV environment to test project exports and see if those are working without problems.
Start Eclipse and choose your workspace.
First activate the “Servers” tab in the bottom window, as shown in the screenshot below:
Then right click the empty space in the window and select “New” and then “Server”.
Just to make sure you don’t encounter strange behavior when you deploy to production, you should always choose and use the same version for development and deployment. In this example we choose “Oracle WebLogic Server 11gR1 (10.3.6)”:
Again: Although it is not necessary, I do like to rename the domain name (Server’s host name) to a value which will show me that I’m working local and on which version.
In the following examples we will also log into the Application server Weblogic via the web console. This Weblogic domain is also named “local_osb_11g” which again helps you to identify the domain when you’re shifting between local / DTAP environments.
For your consideration: Depending on your needs you can later on create several local domains. If you are working on two projects at the same time it makes sense to create two domains.
Most of the time I re-use one domain since you can redeploy all projects in your workspace within a minute. This way you are also absolutely sure that your local configuration is always the way you expect it to be.
In general: Most clients will use one configuration profile for all OSB domains.
After pressing “Next” you will be presented with the Domain Directory selection dialogue, where you will need to adjust three settings:
- Choose “Local” as “Server type”
- Choose your newly created domain via the dropdown and “Known Domains”
- Select “Always start Weblogic server in debug mode” to ease debugging later on
Press “Next” to select the resources which we will deploy on our local domain.
Add the Configuration Project you wish and click “Next” in the next three screens. Click “Finish” in the last screen to finalize your domain configuration:
If you are successful you should have a bottom window looking like this:
We are now ready to start this local server and deploy our newly created Projects.
Right click the top line (which stands for the domain) and select “Start”.
Side note: You can also start the domain via the start menu or straight through the command shell by using “startWeblogic.cmd”. In my installation, it is located at: C:\Oracle\middleware\osb11g\user_projects\domains\local_osb_11g\bin
The tab “Console” will activate and will show the details of the server starting. It will take a minute or two but when the local domain is started you will see the following line:
<10-jul-2012 1:20:47 uur CEST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
Open a internet browser and go to the following URI to open the OSB web console to access your synchronized brand new OSB domain:
After logging in with the user “weblogic” and the password you’ve chosen, it should look like this:
You can see the OSB projects you’ve deployed to this server via the button “Project Explorer”.
Note: You can also develop new services via this SBConsole, most functions which are available via Eclipse also exist in the SBConsole.
That’s it! You are now fully equipped with a running OSB domain on your machine and can start developing and running your own web services.