Somewhat live blogging: Axis WS in NetBeans IDE 6.1

I have to write a tutorial for Axis WS support in the upcoming NetBeans IDE 6.1, so I got a series of instructions from Milan Kuchtiak, the engineer in the know, and got to it. Here's how it went:

Step 1: Download and install Axis 2. Well, that's easy enough, it's just a ZIP file. I see there is also a WAR file that I can download, but Step 2 is building the WAR file, so let's follow the engineer's directions and just download the zip and unzip it somewhere, say C:/ root.

Step 2: Run the build script in the Axis2/webapp directory to create axis2.war. Splendid, although there is no build script, just a build.xml. Wait, if there is a build.xml, then I can build it with ANT. Do I have ANT on my classpath? ... Nope. Have I installed ANT? ... Evidently not. So I install Jakarta ANT, put it on my PATH, and Bob's your uncle, or my uncle, or something. I wish I could write "...and Bob's your uncle" in an official tutorial. Anyway, ANT runs and I get my axis2.war file.

Step 3: Copy axis2.war to the J2EE server webapps directory. I copy it both to TOMCAT_HOME/webapps and GLASSFISH_HOME/domains/domain1/autodeploy.

Step 4: Start IDE.

Step 5: Install the Axis2 nbm plugin file. Milan sent me one as an email attachment, but the 6.1 distro I installed already had it as an available plugin, so that was easy.

Step 6: Go to Tools -> Options -> Axis2 -> Runtime and type in the Axis home directory. Easy enough.

Step 7: Still in the Axis2 Options, switch to the Deployment tab and enter the path either to the Tomcat Axis2.war or the GlassFish Axis2.war. I choose Tomcat since Axis is supposed to work a little better on that server. Milan's advise was to enter the path to the TOMCAT_HOME/webapps/axis2 directory, to which Tomcat unpacks the WAR, rather than the WAR file itself. However, I couldn't find an axis2 directory so just typed in the path to the WAR. Later I found out the significance of this absence...

Step 8: Enter the Tomcat Manager username and password. Fine, except that first I have to find out what they are. Milan said that they are in TOMCAT_HOME/conf/tomcat-users.xml, and he sent me an example of the file. It's a good thing he did, because my tomcat-users.xml is empty. I copy Milan's file into mine, and now I have Manager username "tomcat," password "tomcat."

Step 9: Create a new Java Library project. OK, I name it AxisBoldAsLove. Note to self: Do not make Jimi Hendrix references in official Sun tutorials. I create a myaxis package in the project.

Step 10: Create an empty Axis web service from Java in the project. I choose New -> Other -> Web Services -> Axis2 Service from Java and select "Empty Web Service" from the wizard. I put it in the myaxis package. Well, hurrah! I get an Axis Web Services tab in my project, with the NewAxisFromJava WS (hmmm, I should have selected a name), and the NewAxisFromJava.java class in my source package. Terrible name.

Step 11: Implement the service class. Well heck, I can't open the Axis web service, so I guess I should change the .java class. That however already has some "Hello, World!" output specified by default. Maybe I don't need to implement anything?

Step 12: Deploy the service. I right-click the service and select Deploy... OK, I get a BUILD SUCCESSFUL message, but nothing on the Tomcat log. That doesn't seem right.

Step 13: Check that service is at http://localhost:8080/axis2/services. Er, I have a 404 error. Well, I delete my project and try everything again. Another 404! In fact, I have a GlassFish 404 error. Ah-ha, GlassFish is helpfully occupying 8080 and Tomcat is on 8084. OK, change the Axis options and the service properties and everything else I can think of to 8084. Now Deploy again. Says BUILD SUCCESSFUL again. What do I get at http://localhost:8084/axis2/services? Another 404 message! \*groan\* At least it is a Tomcat 404 and not a GlassFish 404.

OK, Milan's gone but Lukas Jungmann listens to my woes. We go through my project. And here's the nub: I should have copied axis2.war to the Catalina base, which is in Documents and Settings/Jeff/.netbeans, not to TOMCAT_HOME. Well, bloody hell, I copy it to CATALINA_BASE.

Still a 404 error! Lukas scries my log and sees that when I redeploy the WAR file, I'm still redeploying the one in TOMCAT_HOME. So we look at Tools -> Options -> Axis2, and sure enough, it's still pointing to the TOMCAT_HOME WAR file. So I change that, redeploy the service and generate a WSDL file.

Success at last! Everything is where it's supposed to be, and a JAX-WS client can be created based on the WSDL file.

Well, dear reader, by the time you see my tutorial this process should be simplified somewhat. Step 6 is already obsolete, because Milan has received permission to include the Axis libraries directly in our plugin. I'll try to play around with the service code a bit to see if I can make it do anything interesting, but really there's not much to it. All the operations appear to take place in a standard Java class, and that class is then exposed as an Axis web service. To change the operations, you change the java class and these changes are automatically reflected in the Axis web service. Milan's added subnode display to the web service in the project, so you can watch the operations get added to the web service in real time! After changing the service, you of course have to redeploy it, and then whoever is running the client has to refresh it.

Comments:

Comparing this to the current eclipse plugin it seems pretty slick. (which has major issues if certain external libraries are included in the ie. saxon9). The only thing I am noticing is that it does not include any libs from the project under the lib folder in the aar. (which is not a big deal to workaround but would be nice)

Other than that, thanks for point me in the direction of this plug-in. I found that most of the steps here were not needed (namely copying anything into glassfish as I use tomcat)

One thing with this plugin that would be nice is to to able to deploy the aar to a remote server (I haven't discovered how to do this yet). I still end up going through the remote server's axis2 admin console to deploy the aar file.

Thanks again for posting this tutorial.

Posted by Shawn on March 03, 2008 at 01:53 PM CET #

Thank You for feedback.
This is the first version of Axis2 plugin.

We expect to extend the axis2 service(s) configuration for library(jar) chooser to be ready for 6.1.

The remote deployment is a good idea for enhancement. Thank You.

Posted by Milan on March 04, 2008 at 06:56 AM CET #

Hello, I'm can not find the plugin with the name: "Axis2 Support" I have:
Product Version: NetBeans IDE 6.1 Beta (Build 200803050202)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Linux version 2.6.22-14-server running on i386; UTF-8; es_MX (nb)
Userdir: /home/jorge/.netbeans/6.1beta

Installed the full release.

I have looked at: "http://www.netbeans.org/kb/61/websvc/gs-axis.html" and there they install the plugin named "Axis2 Support", but I can't find it, no in the Available Plugins or in the Installed Plugins tabs, the problem is that I have Linux? or any ideas?

thanks

Posted by Jorge Sampayo on March 08, 2008 at 07:43 AM CET #

Hello again
I have installed now the windows version:

Product Version: NetBeans IDE 6.1 Beta (Build 200803050202)
Java: 1.6.0_05; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1252; es_MX (nb)
Userdir: C:\\Documents and Settings\\Usuario\\.netbeans\\6.1beta

but I can not find the Axis2 plugin, there is no Tools -> Options -> Axis2 icon and there is not an Axis2 plugin in the NetBeans plugin center, any ideas?

Taking a look at http://www.netbeans.org/kb/61/websvc/gs-axis.html there in the plugins window it says "Available plugins 101 Installed 73", and I only have "AP 41 Inst 53", what could it be my problem?

thanks

Posted by Jorge Sampayo on March 08, 2008 at 09:22 AM CET #

Jorge,
That is a bit odd. I also didn't see an Axis2 plugin when I installed the latest "All" build of 6.1 (Win), but I have a Tools->Options->Axis2 icon and all the functionality is there. Platform certainly shouldn't matter. We'll look into it.

Posted by Jeff Rubinoff on March 08, 2008 at 10:54 AM CET #

Hello,

I have noticed this in this same behavior in the lastest 6.1 beta build.

I was able to see the plugin in the a nightly build almost a week before.

Posted by Shawn on March 08, 2008 at 11:03 AM CET #

Ahh, what bad luck I have -_-

Then I must wait for some update in the NetBeans plugins or maybe there is a way to install it, uhmm, "manually"?

best wishes.

Posted by Jorge Sampayo on March 08, 2008 at 12:37 PM CET #

Regarding the Axis2 plugin:
In your Plugin Manager (Tools->Plugins), go to the Settings tab and make sure that Latest Development Build is listed and active. If you need to add it, the URL is http://deadlock.netbeans.org/hudson/job/javadoc-nbms/lastSuccessfulBuild/artifact/nbbuild/nbms/updates.xml.gz
I just installed 6.1 Beta and didn't have an Axis2 plugin listed. I went to the Plugin Manager and found that Latest Development Build was there and active. I changed update frequency from Weekly to Every Startup. Then I went back to the Available Plugins tab and clicked Reload Catalog. The Axis2 plugin appeared in the list. I installed it and as far as I can tell it works correctly.

Posted by Jeff Rubinoff on March 11, 2008 at 07:42 AM CET #

The latest axis2 plugin can be downloaded from this link :
http://deadlock.netbeans.org/hudson/job/javadoc-nbms/lastSuccessfulBuild/artifact/nbbuild/nbms/extra/

Posted by Milan on March 11, 2008 at 08:19 AM CET #

Just to explain.

Though Axis2 plugin is still not accessible from NetBeans IDE 6.1 Beta installation (hopefully will be from NB 6.1 FCS) the nbm can be downloaded from the link I sent in previous comment.

Posted by Milan on March 11, 2008 at 08:25 AM CET #

Does the plugin work in Netbeans 6.0. If not, why is there no development?

Posted by Vyas Sanzgiri on March 12, 2008 at 08:54 AM CET #

With NB 6.1 so near and the plugin not complete there's no need to port it to 6.0.

Posted by Javier Ortiz on March 31, 2008 at 09:18 AM CEST #

Hi!

Using the Axis2 plugin I try to create a "Axis2 Service from a WSDL". My problem is, that the "Finish"-button in the wizard remains grey after filling out the WSDL URL. I have also tried to point to a local WSDL-file with the same result. Any ideas what causes that?

(I am able to create "Axis2 Service from Java" with no problem using the wizard)

Moreover it seems that the Axis2-plugin is only available from a "Java Class Library" and not a "Web Application". Have I missed something in the setup?

Thanx

Posted by Jesper Sahner Pedersen on June 04, 2008 at 07:42 AM CEST #

The limitation of Axis plugin is that it works only for local wsdl files.
You should first press the Next button in wizard and fill the code generator options.

Axis2 plugin calls Axis2 wsds2java ant task.
Try manually whether your wsdl can be processed by this task. If not, problem is in axis.

You're right axis2 plugin enables to create services only in Java Library or Java Application.

Posted by guest on June 04, 2008 at 09:57 AM CEST #

Sorry, I forgot to fill in my name.
Look also at this blog:
http://blogs.sun.com/milan/entry/4_databinding_frameworks_to_create

Posted by Milan on June 04, 2008 at 10:00 AM CEST #

Thanx, got it working with a local copy of the URL. Guess that pointing to an external URL will be possible in a future version as the wizard suggests.

Posted by Jesper Sahner Pedersen on June 05, 2008 at 12:32 AM CEST #

One more comment: The plugin creates the services. Can it also create the client stubs?

Posted by Jesper Sahner Pedersen on June 05, 2008 at 03:39 PM CEST #

Jesper,
The plugin does not create the client stubs. You can create standard JAX-WS client stubs that consume Axis services. This is mentioned in the full version of the tutorial, at http://www.netbeans.org/kb/61/websvc/gs-axis.html

Posted by Jeff Rubinoff on June 05, 2008 at 05:28 PM CEST #

Is there a way to undeploy the services from glassfish/axis2 using the NetBeans IDE? Actually, I couldn't find any way to permanently remove a service from the server once it's deployed. Any help is welcome.

Thanks!

Posted by Ivana N. on June 12, 2008 at 11:32 AM CEST #

Ivana,
With the server running, open the Services tab in the IDE and expand the GlassFish node. Expand the Applications node, right-click on the application you wish to undeploy and select Undeploy.

Posted by Jeff Rubinoff on June 18, 2008 at 03:22 PM CEST #

Hi,

I tried created a web service deployed by axis (tomcat) in netbeans by following the above steps in the tutorial . Now the web service was created in the following address (http://localhost:8084/axis2/services/sahello?wsdl)

Now when I import the WSDL creatred in a BPEL module in netbeans and then do a validate XML it throws the following error on the WSDL file

ERROR: A <http:binding> element's input requires a <http:urlEncoded> or <http:urlReplacement> element.

But if i create a web service using netbeans and glassfish , if i then import this WSDL and do a validate XML I do not get this error .

It will be great if you can help me regarding this.

Thanks
Mithun

Posted by Mithun on June 24, 2008 at 11:37 PM CEST #

I am not sure I understand. Do you have problem to integrate Web Service, created in Axis, to BPEL application ?

I personally think, the problem is with:

<wsdl:binding name= "SaHelloHttpBinding"
<http:binding verb="POST"/>
...

BPEL has problem to process this binding.

My suggestion: copy wsdl file, generated by Axis, remove the "SaHelloHttpBinding" element and try to use this wsdl in BPEL.

Milan

Posted by Milan on June 30, 2008 at 07:15 AM CEST #

Thank you for your help! This worked for me on IDE 6.8 by just skipping past the inconsistent bits.

Posted by John on December 22, 2009 at 02:58 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

I'm a technical writer for NetBeans, covering web service support.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today