Home > web services, Weblogic > Weblogic 10.3 Sample JAXWS web service development

Weblogic 10.3 Sample JAXWS web service development

This post explains development, deployment and running a web service in simpler steps…


Assuming you followed all the steps of weblogic installation and paths rightly set. If so move on to next step…


Write a sample web service

package com.weblogic.sample.service;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(serviceName = "MyWLService_Service", targetNamespace = "http://localhost:7001")
public class MyWLService {
@WebMethod(operationName = "sayHi")
public String sayHi() {
return "Hello Everyone! Weblogic Service response!";


I am using ANT script to build my web service.

  • set weblogic.path to <wl_path>\server\lib\weblogic.jar
  • You should have ANT installed and ANT_HOME set
  • we use jwsc and jws weblogic ant tasks to run the below script
<project name="MyWLService" default="build" basedir=".">
<target name="init">
<property name="app.name" value="MyWLService" />
<property name="weblogic.path" value="C:\\oracle\\Middleware\\wlserver_10.3\\server\\lib\\weblogic.jar" />
<property name="src.dir" location="./src" />
<property name="bld.dir" location="./build" />
<property name="lib" location="./lib" />
<target name="clean" depends="init">
<delete dir="${bld.dir}" />
<delete dir="./war" />
<fileset dir=".">
<include name="${app.name}.war" />
<target name="build-setup" depends="init">
<mkdir dir="${bld.dir}" />
<path id="add.class.path">
<pathelement path="${weblogic.path}" />
<pathelement path="${java.class.path}" />

<target name="ws-compile" depends="init, clean, build-setup">
<taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask">
<pathelement path="${weblogic.path}" />
<jwsc srcdir="${src.dir}" destdir="${bld.dir}" classpathref="add.class.path">
<jws file="com/weblogic/sample/service/MyWLService.java" type="JAXWS" />
<target name="build" depends="ws-compile" />

Run the ant task by issuing ‘ant build’ command. You should see a war file created in your projects folder.


Now go to weblogic admin console http://localhost:7001/console

login with you userid/password

On successful login, you’ll see the home page. On the left hand side navigation, select Deployments

Install war in the deployments

Click on Install button and select the just created war file


Now, select your war file and click next.

In the next screen let the default options be selected, click next till you see FINISH button.


You should now see a success message stating your war deployed successfully.

Now you should check if wsdl file got generated successfully or not

In the browser http://localhost:7001/MyWLService/MyWLService_Service?WSDL your wsdl file should get loaded. This ensures that your webservice is deployed successfully and it’s time for invoking your service.


Since I’ve APACHE CXF installed on my machine I’ll use WSDL2JAVA to generate client code. You may also depend on other stacks to generate client code.

Another easy way is to install soapUI, it’s very simple to use and all you need to do is to map the wsdl to the project and invoke the service.

However with WSDL2JAVA ‘am gonna issue a command at a desired folder path where I would want to have my client

<p>wsdl2java -client http://localhost:7001/MyWLService/MyWLService_Service?WSDL</p>

In the client code just execute client class with main method() that’s it!

Next post on securing this web service.

  1. May 23, 2013 at 6:00 AM

    Thank you for the good writeup. It actually was once a amusement account it.
    Glance complex to far added agreeable from you!
    However, how could we communicate?


  2. August 5, 2013 at 1:10 PM

    I have read so many articles on the topic of the blogger lovers however
    this post is in fact a nice paragraph, keep it up.


  3. September 21, 2014 at 9:53 AM

    What a data of un-ambiguity and preserveness of valuable experience
    concerning unexpected feelings.


  4. September 21, 2014 at 11:55 AM

    Simply desire to say your article is as amazing.

    The clearness to your post is just nice and i can think you’re knowledgeable on this subject.
    Well along with your permission allow me to seize
    your RSS feed to keep up to date with approaching post.

    Thanks 1,000,000 and please carry on the enjoyable work.


  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: