Tutorial: How to create Axis web service with IntelliJ IDEA? Part 1: Service side

Axis is an engine to create web services. It has implementations in Java and C. In this post we will see how to create Axis web service as java project with IntelliJ IDEA version 14.

Last stable release of Axis was produced in April 2006. Now Axis replaced by Axis2. Axis2 has more features and it is certainly recommended to use Axis2, not Axis. I will write about Axis2 later. When I needed to create Axis2 web service, I started with Axis, because it is easier to understand the principle with special plugin for IntelliJ. There is plugin for Axis2 too, but it is not compatible with IntelliJ IDEA 14.

We will create both sides: service and client. This post is about create service side.

What do you need:
– IntelliJ IDEA
– Tomcat

Step 1
Create project (“File”->”New”->”Project…”). In dialog window select from left column Java Enterprise. Select Tomcat as Application Server. If there is no configured Tomcat, press “New” and set path to Tomcat. You can download Tomcat version 8 here.

From “Additional Libraries and Frameworks” select WebServices. Use generate sample server code block. IntelliJ can download library, but I prefer to download and set library manually. You can download Axis library from here.
Your dialog window should look like in screenshot below.

step1

Press “Next”. Set the name of the project.

Step 2
Automatically generated directories and files:

step2

Then we need to configure library of artifact. Click “Build”->”Build artifacts…”. In appeared dialog window click “Edit…”. Add Axis library to WEB-INF/lib folder (you can just click on “Fix” in the bottom of dialog window). In picture below JAX-WS is Axis library:

step2-4

Add “@WebService” and “@WebMethod” into HelloWorld like in picture below:

step2-3

Compile this file by pressing “Ctrl”+”F9”.

Click on HelloWorld file. Select “Tools”->”Web Services”->”Generate Wsdl From Java Code…”. Dialog window appears, where you can define several parameters, choose web functions.

step2-2

We just need to click OK. After that HelloWorld.wsdl file have to be generated in directory where HelloWorld.java located.

Note: Please pay attention to Arda’s comment:

Screen Shot 2016-04-08 at 13.41.19

Step 3
Our service is ready. Press “Shift”+”F10”.

Step 4
If everything OK and you didn’t change default running options, new tab should appear in internet browser. Type “http://localhost:8080/services” (8080 is port of Tomcat, your Tomcat port number may be different). In this page you can see the list of installed services:

step4

If you see HelloWorld (wsdl), everything is OK. Great! We’ve done creating sample Axis service on java.

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Profile photo of Doszhan Kalibek

Doszhan Kalibek

  • edwin dennis

    when I run http: // localhost: 8080 muetra me this
    $ END $
    because?

    • Sorry, I don’t understand. Maybe your message was cut out for some reason. I’ve never met a case, where I see on page only “$ END $”

  • edwin dennis

    What to do with the index.jsp ?

  • Mark

    Hi – followed the tutorial.

    I let intelliJ Download the axis libs. But apart from that followed it closely.
    Get to run the Service but I don’t see The HelloWorld Service.

    All I have are the default wsdls at http://localhost:8080/services
    AdminService
    Version
    SOAPMonitorService

    It looks like it deployed correctly according to tomcat console log messages.
    Any ideas?

    • Hi Mark.

      Be sure that you’ve generated wsdl: Tools”->”Web Services”->”Generate Wsdl From Java Code…”. “Add to development” checkbox should be ticked.

      Also try to edit server-config.wsdd file manually as Til suggested.

      • Teguard

        Got the same problem,
        Where is said “Add to development” checkbox located?
        And do you have a tutorial how to correctly edit the wsdd file?

        • Unfortunately I can answer to this question not earlier than Monday. Hope you can find the solution earlier :)

  • Til

    Is it possible that one has to put in the service description in the server-config.wsdd manually? In my case, intellij idea didn’t insert it automatically. Or did I miss an option?
    Anyway, nice tutorial.
    All the best, Til

    • Hi Til.

      It seems sometimes IntelliJ Idea does not insert it automatically. It should be done automatically. Maybe you can try to set axis library manually.

  • Arda

    Hi! I noticed that Intellij doesn’t catch annotations when you write manually (Step 2). To add the service description automatically into the config, click on the class name(HelloWorld) and in the yellow bulb menu select “Expose class as Web Service”. Also click on the method name and in the yellow bulb menu again choose “Annotate method as @WebMethod”. Thanks for this tutorial.

    • Arda, many thanks! Added your comment as a note into the post.

  • Awais

    I did every thing like mentioned above but i got following error
    java.lang.IllegalStateException: Error looking for paramter names in bytecode: unexpected bytes in file

    plz help im stuck into this