Friday, July 12, 2013

Java Web-service using JDeveloper

With help of this post we will learn how to Develop, Deploy and Test a Java Web-service using JDeveloper.

In this use case we will first write a simple Calculator Java Code having 4 functions (Addition, Subtraction, Multiplication and Division), expose it as Web-Service, Deploy it and then at last Test it.

I am using videos as I believe understanding from video is much more easier and comfortable than writing steps and screenshot. :-)

Part 1 - Development Video 

Part2 - Deployment Video

Part 3 - Testing Video

Thanks for reading the post and watching the videos. Hope it helps.
Please leave your valuable feedback in comments section.

Cheers. :-)

Wednesday, July 3, 2013

Just for fun.

Bored of waiting for JDeveloper to start-up and looking at same picture every time? 

Always thought of changing JDeveloper start-up picture?
Here is how you can do it.
  • Your default start up picture looks like - 
  • Now using Google images and paint (maybe other tools) create a picture which u want to see when Jdeveloper starts up.
  • Save it with name and extension as splash.gif. 
  • Replace it with splash.gif file located in $Middleware_Home\Middleware\jdeveloper\jdev\bin.
  • Restart your Jdeveloper. Enjoy the new picture this time instead of getting bored while your Jdeveloper restarts. Below is what I created for my personal use. 
Hope you like this post. Enjoy. :)

Wednesday, June 26, 2013

Separate Numbers and Characters from string using XSL

This can be achieved using Xpath function translate in XSL. 

Let us first understand how this function works, then we will use it for our requirement.

Xpath function : string translate (string, string, string)

The translate function accepts 3 arguments and returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. 
Lets understand it by an example, translate("bar","abc","ABC") returns the string BAr. If there is a character in the second argument string with no character at a corresponding position in the third argument string (because the second argument string is longer than the third argument string), then occurrences of that character in the first argument string are removed. For example, translate("--aaa--","abc-","ABC") returns "AAA". If a character occurs more than once in the second argument string, then the first occurrence determines the replacement character. If the third argument string is longer than the second argument string, then excess characters are ignored.

Solution to our problem - 
  • For fetching numbers use -
    Above statement will return '123123'

  • For fetching characters use -
    Above statement will return 'qweasd'

Please leave your valuable suggestions in the comments section. Enjoy.  :)

Monday, February 11, 2013

Last day / date of a Month

How to get last day / date of a month using XSL

Below are the steps used for achieving it. I have used Xsl variables so that it becomes easier to understand.

  • Create a month and year variable.
  • Add Choose xsl node where we will have one when condition (to check whether month is Feb and year is leap year or not) and in otherwise we will simply get the date. Below is the Xsl source code -

                Thats it. You can test the same in Jdev itself and verify. 

Friday, February 8, 2013

Send XML file as attachment using Email activity in SOA / BPEL 11g

Few days back I got requirement of sending email with attachments. 

The catchy part of it is sending an XML file as attachment. Thought of sharing the solution.

Steps are:
(Version of J-Dev used is

1. Create a BPEL project. 
2. Modify input schema element 'process' to have 'To' and 'AttachmentBody' as string type elements. 
3. Insert a Email Activity inside BPEL.
4. Double Click on the Email activity and set / pass values to required fields. 

5. Create a Temp variable say 'EncodedTemp' and copy 'AttachmentBody' to the EncodedTemp' using assign activity.

6. Insert a JavaEmbedding Activity which will encode the contents of 'EncodedTemp' to Base64Encoding. Below is the code which is used - 

          To use Java Embedding you also need to import oracle.soa.common.util inside BPEL.
          Go to BPEL Source and paste import statements above Java Embedding activity -

7. Now Double click on Email activity again and click on Attachments. Set the values as shown below - 

That is only what you need to do. Deploy the project and test it. It works absolutely fine.. :)