How to create a sample Web Service using JDeveloper

Thanks to Hussain for creating this tutorial. I am just extending his learning with some additions of mine.

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

3) Enter Class Name as CreditRating and Package name as

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


public class CreditRating implements Serializable
public CreditRating()
* Do read this link for help
* in case of issues :
* @webmethod
public String getCreditRating(String customerId)
String rating;
if("abc".equalsIgnoreCase(customerId) ||
"xyz".equalsIgnoreCase(customerId) )
else if("pqr".equalsIgnoreCase(customerId))
rating = "Invalid Customer id";
return rating;

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

6)Enter WebService Name and Select the CreditRating Class as Component to Publish and click Next

7) Once You Successfully generate the Java Web Service, You need to deploy it and Test the working of the Web Service
8) Right Click on MyWebService1 and Select Run. You’ll see a URL in the Log window as shown below.

0 Replies to “How to create a sample Web Service using JDeveloper”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.