Tuesday, May 4, 2010

Create Java WebService using JDeveloper 10g

The Sample WebService will return Credit Rating of the customer if the customer Id is Valid else it will give response as Invalid Customer Id

1) Open JDeveloper, Create New Application and Project as shown below

2) Create a Java Class, Right Click on Project->New->General->JavaClass

4) Enter Class Name as CreditRating and Package name as com.ws

5) Write a Method called getCreditRating inside the class CreditRating class. the method should accept customer id and return a CreditRating of the customer.

6) Compile your Project, After Successful Compilation, Right Click your Project->Business Tier-> Web Services-> Java Web Service

7) Click OK, Select J2ee 1.4 (JAX-RPC) Web Service and click OK

8) You will be prompted to welcome page of Creating Java WebService Wizard, Click Next

9) In Step1, Enter WebService Name and Select the CreditRating Class as Component to Publish and click Next

10) Click Next, In Step 5 Select the Checkbox of getCreditRating Method in the List of Availbale Methods.

11) Click Finish to generate Java Web Service, Make Sure no errors will occur this time.

Once You Successfully generate the Java Web Service, You need to deploy it and Test the working of the Web Service in SOA_Suite(Oracle Application Server).

Step1: Start Oracle SOA Suite,

Step 2: Follow the below steps for getting connection of your application server in Jdeveloper 10g.

a) Go to Connections Tab, Right Click New Application Server Connection, Enter Connection Name as SOA_Suite,

b) Enter Username and Password of the Application Server in my case its oc4jadmin.

c) Enter the values for hostname and opmn port.

d) Test the Connection, make sure you will get Success message.

Step 3: Deploy your Java Web Service to Oracle Application Server to test it.

a) Right Click the webservice.deploy->deployto->SOA_Suite

b) Once the Deployment is Successful, Login Oracle Application Server Control, to check your Web Service is Deployed.

Step 4: Test your Web Service:

a) Select your Web Service and Click on Test Web Service .





  1. I get a message on step 6

    When I select the method getCreditRatings

    It comes in gray color as if it is disabled.
    And there is a "Why not?" button besides, and when I click it I get the following message

    Method getCreditRating: The following parameter types do not have an XML Schema mapping and/or seralizer specified:


  2. Hi,
    I got the solution,

    It must be a primitive, String or a Java Bean Object. It can't be object.


    The java.io.Serializable marker is not consulted when determining whether a Java object can be transmitted in a web service invocation. Instead, each parameter and return value of a web service method must conform to one of the 3 rules below:

    1. It is a Java primitive (int, long, byte etc.), Java primitive wrapper (java.lang.Integer etc.), or a java.lang.String.
    2. It is a Java bean with a zero-argument constructor, and a pair of "get" and "set" methods for each property to be exposed. Each property must itself conform to one of these 3 rules.
    3. It is an array of a type that meets either rule 1 or rule 2.

    1. java.lang.ClassCastException: org.apache.xerces.dom.ElementImpl i m getting ths while running through OC4J server

  3. BlueHost is ultimately one of the best hosting company with plans for any hosting needs.