Find below the step by step process to create a web service from the java class and how to test it using the integrated weblogic server that comes bundled with the JDeveloper 11g. This approach is also known as Bottom Up approach.
# Open your JDeveloper
# Create a new application and lets name it as MyDateWebService
# Name the project as DateService and shuttle across the Project technologies that we intend to use. Here, I select Web Services. The dependent Java technology gets selected of its own.
# Once Finish button is pressed, the view of the Jdeveloper looks like as depicted below
# Within this newly created project, we create a new java class by doing right click on the project and selecting 'New' - 'New Gallery' window pops open
# Name the java file as 'CurrentDate'
# Modify the newly created java file and add method which needs to be exposed as webservice. Here, I have created getDate() method that returns a string value of the current datetime. Import the needed Date class as shown.
# Now, our class is ready to be exposed as web service. Right click on the java class and in the window that pops open, select 'Create Web Service'
# The Create Web Service process starts. In the step 2, choose Java EE 1.5, with support for JAX-WS Annotations
# In Step3, modify the name of the web service to 'CurrentDateWS'
# Step 5, confirm the methods that need to be exposed as web Service. Press Finish here as we are fine with the default settings in other steps.
# Observe the annotation change in the java class
# Now, our web service is all ready to be tested. Right Click on the java class and choose 'test Web Service'
# This opens the HTTP Analyser window as shown below. Press Send request button.
# As we see here in the window below, the HTTP Analyser presents below the response from the deployed web service.
# Double click on the WSDL URL present in the HTTP Analyser to view the WSDL associated with our web Service as shown below
This ends our simple exercise to create a web service from Java class.
Another great post. Thank you!
ReplyDelete