I used to enjoy developing Apache-Axis Web Service with NetBeans3.6, creating souce files or operating Axis' commands with nice graphical IDE interface. The new version NB4 made a drastic change and my former ways became unavailable. In return, the coming NB4.1 would suppoert Web Service project by default! ...But I see there are still people who like to introduce a raw Axis module into Tomcat server and make Axis-generated files, with NetBeans. So I made a try to make up a system for Web Project of NB4 using Axis!...Notice, this is so long a story that it's written from top to bottom of the page to be completed. Any new topic would be written in another page.
Apache Axis 1.1 was used. Download a bynary product from Apache Axis website.Extract it to obtain "axis" web application directory .Then locate it at a directory as you like. I did in this report at e:\nonidata\nb4rcworks\axis.
Then, NB4. the project I created first was "Web Project with Existing Sources".
"Location" that contains all the sources for the web application corresponds to the document root of the Web module to use, I believe. I set it to be e:\nonidata\nb4rcworks\axis.

Project Name is "axisproj".
Oh, oh. I'm sorry, I took a shot with wrong setting of "Project Folder". It must set to be E:\nonidata\nb4works\axisproj and I finally did so.
Once you select proper "Location" to all the sources, the wizard goes fetch other proper settings required to build the Web Project.

J2EE 1.3 is maybe not bad . So the
Web Project started!
Below is the structure of axisproj Web Project displayde in "Projects"
window. A great structure built by the Axis team...
to be continued far below...
Let's try at first the easiest web
service, featured in Axis, by deploying jws files.
NB4 still doesn't know a file with jws extension. So what to create is an Empty
File. It is done by right-clicking the node Web Pages and select "New"
-> "Empty File".


The file wsone.jws was created
right under the axis directory, the document root.
Take a look at the bottom of branch of Web Pages node.

Then edit the wsone.jws file like this:

NB4 never take it as a java file so never provides hilighting nor completion, a bit sad...Anyway, the service is to cheer up the name sent by yelling "Go Go! "
To start Axis Web Service, just right-click thie "axisproj" and select "Run Project". Bundled Tomcat 5.0.28 starts, and then the web browser to show the start page prepared by Axis. You can continue the service after closing the browser.
You can make sure axis application has been deployed to Tomcat, by openeng Tomcat node in "Runtime" window.

I 'm afraid creating the client app might be one of the most complicated work to study Web Service. In addition, if it is an console application, that INSECT speaks a lot on executing it. There seems to some settings for "Shut up you Insect" mode prepared in IDE, but we might listen to it to know if the build script itself is going well. In this way I made up my mind to make the client application as GUI form instead of output to the colsole.
Let's create a new project for the client app. A standart Java Project, named "axisclient". Please try here for how to create a standard Java project. Also in this project evade setting Main Project or creating Main class.
Right-click the Source Packages node of the newly created axisclient project, and select"New" -> "JFrame Form".

I set the Class Name to be ClientOne with package name client.

Well I don't like configuring layouts of Frames, it takes time...my hope is such layout as below:

The Japanese written in JLabel means "Input your name", together with its English translation.
The name is input to the JTextField and sent to the Web Service by a click of JButton, then the answer is displayed in JTextArea.
Well, how to realize an excellent
layout with the least setting? I don't know. I took a "heavy but sure to
work" way:
In NB4's GUI Editor, JFrame privides BorderLayout by default. Add three JPanels
on its North, Center, South positions each by each.

To add JPanels, click its icon on the Palette, and then click the Form. If you click the upper part of the form, the JPanel is set on North. To set the panel on Center, click near the center of the form. Though you click the lower part of the form to set the panel on South, it might go to hide under the structure of the large centered panel:

In this case you can correct the position by drag the last panel and drop right under the JFrame node in Inspector window.
After each of three panels got its proper position, add JLabel, JTextField+JButton, and JTextArea, each by each. JPanel provides Flow Layout by default. So in this simple case, just adding the text field and then the button, they are set side by side.

Rename the name of each component to show its role.
The JFrame is to have a definite size. Display the "Code" page of JFrame's Properties window and change "Form Size Policy" from "Generate pack()" to "Generate Resize Code".

Therefore the size of the frame has been set to be 400 in width, 300 in hight ( and can be changed if needed).
Then define the sizes of some components as needed. The size of each JPanel seems to be set automatically to fit the components added to it. For example, the preferredSize of the JTextArea is set like below:

Set the preferredSize of the JTextField,
too. The label and the button is to be set automatically, because they have
a certain text to be labeled while the text field and the text area are initialized
to be blank.
The text of JLabel is set like this...

Ohhh, the Japanese characters are turned into white squares in rc1! But the tooltips give us readable one. And also, there is no problem on displaying in the Form.
Excuse me to finish with GUI Editing here. Perhaps you would like me to proceed for trying to connect the Web Service...
The client app needs the codes to connect to the Web Service and obtain the string responded by it. For that, the classpath is need to be set for the classes related to Axis Web Service.
We are going to create some other projects using this classpath afterwards. So it's good to create a common "Libraly" using Library Manager.
Select from menu bar "Tools" -> "Library Manager".

A large window of Library Manager appears. Click the "New Library" button located near the bottom of it to create a new Library AxisLibrary.
It's after creating it.
Selecting this "AxisLibrary" from the list, click "Add JAR/folders" button to introduce jar files required for Axis Web Service. Don't be afraid of tofu-attack, my Japanese(and maybe Korean, Chinese) friends. Select all from axis/WEB-INF/lib.

Then this AxisLibrary can be used commonly by different projects.
Let's use it for axisclient project now we are building. Go to "Projects" window, right-click its node and select "Properties". Select "Compiling Source" from the list at the left part inthe Properties Window for axisclient project. then click the "Add Library" button at right side of "Classpath for Compiling Sources" . Select "AxisLibrary" from the list to appear.
We are at last going to edit the source of this client program. switch to the source editor by clicking the Source tab? at the upper part of the editors window.
![]()
First, a method to connect the Web Service, send the string, and then obtain the response as a string. Locate this code somewhere in ClientOne.java.
public String getOutputString(String inputString){
String outputString="";
try{
String endpoint="http://localhost:8084/axis/wsone.jws";
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));
outputString=(String)call.invoke("getString", new Object[]{inputString});}
catch(Exception ex){
outputString=ex.toString();
ex.printStackTrace();}
return outputString;
}
While editing this, we can use a new facility of "Fix Imports".Right-click somewhere in the code and select it from the menu.

The list appears to select proper class to import. take care of its package....

After completing the method getOutputString method, return to GUI editing. Double-click the Send button on the editing Form, so the source editor appears again to show where to describe the handling code for the action performed on the button.

the code to be inserted is only one statement:
outputText.setText(getOutputString(inputField.getText()));
Okay, the client application has been completed!
Then let's compile and execute ClientOne! Oh, make sure the Web Service, I mean the bundled Tomcat, is running. Right-click the node ClientOne in "Project" window, Then select "Run File".
It's the result of clicking the Send button after inputting the name Noniko! Yeah! Come on Tokyo! Therefore the jws Web Services was easily developed also by NetBeans 4.
The Document from here (downward) is for someone who wants to use Java2WSDL or WSDL2Java AT ANY COST (Like me because I wanted to compare the method with those using NB3.6).
Now We have Strong support for Ant in NB4.x, so the recommended way is to make use of Axis ant tasks. This way is described in the new page:Axis-ant with NB4.
Or if you are not so much fixed to use Axis tools for Web Services, Jump straight to
http://www.netbeans.org/kb/articles/quickstart-j2ee-41.html
And you could do everything.
Next let's try a service using WSDL. Create a new project for it, named axiscommands. It is also a standard Java Project without Main class (so a "Java Class Library"?...there seems no big difference between Java Project and Java Class Library)

There let's create a Java Class, WSTwo, with package name ws2local.

Edit the code to be:
package ws2local;
public class WSTwo {
public String getString2(String name){
return null;
}
}
There's no meaning to write about the method to use in future Web Service. The code written here would be return to null while transfeering Java-> WSDL->Java. So just write to return null.
We must make configuration for executing Axis tools for WSDL in NetBeans. There were very elegant ways for that in NB3.6. I described about it in my Japanese Page, which I have no energy to translate to English because it's a GLORY IN THE PAST. If someone want the English version, please notice me so I will recall my power to make it. That good old way is no more available in NB4, for this you could see my recent page "The taming of the Ant".
But I will take any way to realize right-clicking execution of Java2WSDL or WSDLJava!
First, edit properties of the project. Display the setting for "Runnning Project".

Here Working Directory is set for executing Axis tools. We don't need to care about WSTwo, not to be executed. Set it to be axis/WEB-INF.
In this properties window also the library "Axis Library" must be added to its classpath as done for the axisclient project above.
Now we are entering into editing the files. Switch the window from "Project" to "Files" and opennbproject node.
nbproject directory is seen in "Files" window,
First, let's edit project.properties file. Add the following properties, which are set of FQN of the Axis classes and their arguments, related to WSDL Web Service.

To set the values of the three "main...." properties for Axis classes, there is a way to prevent from mistake.

The above large screenshot shows the way to get FQN of the class AdminClient.. The Web Project axisproj contains axis.jar file in its lib directory. NB4 can analyze a jar file to show nodes of the class files included in it. Let's display properties window of AdminClient.class node. To my (our?) regret there are nothing to edit there, but we can browse the FQN of the class. To copy and paste it on the property files, we can avoid making mistake in typing.
As for details of the properties named "args..." please consult with Axis documents. Just please take a look at how to adapt the well-known usage of Axis to GUI operation of NetBeans....
Then add the custom targets for runnning Axis executables. My recent page "The taming of the Ant" will help for this in detail. The xml format is similar to those in build-impl.xml file titled by
<!--
=================
EXECUTION SECTION
=================
-->.
like below:

....Oh, did you find the notice "DO NOT EDIT" "EDIT ../build.xml INSTEAD" in this file? So add the above targets in build.xml.
The three added targets runj2w, runw2j and deployservice are intended for the following commandlines respectively:
org.apache.axis.wsdl.Java2WSDL -o ws2.wsdl -lhttp://localhost:8084/axis/services/WS2Service -n urn:ws2ws ws2local.WSTwo
org.apache.axis.wsdl.WSDL2Java --server-side --output classes ws2.wsdl
org.apache.axis.client.AdminClient -p 8084 classes/ws2ws/deploy.wsdd
With the argument of Java2WSDL we
have named our Web Service "WS2Service".
You see the word "classes", it's the relative path. Perhaps "axis/WEB-INF/classes..."
would be easier to imagine.
"ws2ws" could be explained as the package name to be created together
with Java files for Web Service by Axis.
AdminClient needs the arguments "-p 8084" because of using the bundled
Tomcat.
Now the axiscommands project has been customized wonderfully by original properties or Ant targets added into its configuration files. But my humble experience says this project itself would quite DULL. A bug? A spec? A STANDARD project never seems to move aside from its STANDARD way whatever drastic configuration has been made. For fully activation of its added features we must make a Free-form project making use of its configuration files. Select "Java Project with Existing Ant Script" as the type of the project....

The name of the project was axiscommandproj...Sorry! At that time no idea and energy had been left in me to make up a nice distinguish name for new things...

"Location" and "Build Script" are impotant settings here. The former needs "nbproject" directory of axiscommands project. The latter needs "build.xml" file direct under the root of axiscommand project.
The project file could be located anywhere....the above screenshot shows I happend to locate it to an odd place. It's not my true intension to parasitize it in nbproject directory of axiscommands...But it happendely is rather good idea because if you backup the axiscommand project, you could back up the free-form project at the same time....
Never mind, it WORKS ANYWAY! Right-click the icon of insect walking on two feet (Don't you think so?) and show the properties window!

"Build and Run" is the title to be selected. Edit "Custom Menu Items". these targets were made in the build-impl.xml file of the axiscommands project, which this free-form project is based on. Give these targets nice and clear Labels to display them in the Popup menu.
Let's executeJava2WSDL by right-clicking. The target icon is the "walking ant" axiscommandproj. In the popup menu you can see the three menu items added....

Select "Java2WSDL". The cosole output would be nothing more than "Build SUCCESSFUL". But never believe it. This insect would think his(her?) work as finished at the moment he(she?) emit the required command and never care about the result.Did we really get the WSDL file? Let's check the axisproj project...

Oh, we got it! Could you open the file and read the content?
Next, WSDL2Java. Execute from the same popup menu. After output of "BUILD SUCCESSFUL", check the "Web Pages/WEB-INF/classes" node of axisproj project.

Now we got ws2ws package...In fact, the refreshment of "Project" window might be somwhat delayed. If you cannot find the new package there, switch to "Files" window and check "axisproj - Web Module"node. You can also see the contents of axis web application.The screenshot below is of "Files" window, displaying all Java files created.

We got all files required for Axis Web Service. The last work is completing WS2ServiceSoapBindingImpl.java.

The original "return null;" has been replaced to return acutual string to respond.
Compile the whole ws2ws packge. Right-click ws2ws node and select the item "Compile Package" not provided in NB4 beta2. The developers might have forget it....busy people...Anyway, were they all compiled without errors?
Let's deploy the prepared WS2Service using AdminClient. Right-click the icon for axiscommandproj project and select "Deploy Service".
Oh, there was a response from some other than Ant. As we got these successful messages, let's check server-config.wsdd file tobe created underaxis/WEB-INF directory....OH?
No server-config.wsdd file.
But I made a client application for this condition( its details is shown afterward) and did got the response from WS2Service! WHY?...I finally found out the server-config.wsdd file.Here!

Yes! it was hidden in "build" directory of axisproj project...more precisely, E:\nonidata\nb4rcworks\axisproj\build\web! This directory seems to be a whole copy of E:\nonidata\nb4rcworks\axis\...
These two directories can be compared at a glance if you make use of "Favorites" window, as I have described its details in my recent page "The taming of the Ant". All projects created in this page are gathered under one root directory, "nb4rcworks". Adding this root directory to "Favorite", you can see its structure as below.

Oh, you can see there is another differece between them. There is a misterious Tomcat5.dpf file in axisproj/build/web directory...which is considered as what is woking in the bundled Tomcat in NetBeans. This fact is coincide with that AdminClient selected this directory to create server-config.wsdd
If you are using Linux OS, you might have a trouble on executing the above AdminClient with the message
When I made the same trial using the same Axis1.1, NetBeans3.6 and SUSE LINUX9.1, there was no trouble. But this time, using Axis1.1, NB4 and SUSE 9.1, I met the above trouble. The difference between these cases is just the version of NetBeans....or Tomcat bundled ? Sorry, I don't know. But I found the solution anyway. Use
instead of org.apache.axis.client.AdminClient. I found it in the deploy.wsdd file created by WSDL2Java in WEB-INF/classes/ws2.
<!-- Use this file to deploy some
handlers/chains and services -->
<!-- Two ways to do this: -->
<!-- java org.apache.axis.client.AdminClient deploy.wsdd -->
<!-- after the axis server is running -->
<!-- or -->
<!-- java org.apache.axis.utils.Admin client|server deploy.wsdd -->
<!-- from the same directory that the Axis engine runs -->
To use this new Axis tool, add these settings to project.properties file in axiscommands project.
main.admin=org.apache.axis.utils.Admin
args.admin=server classes/ws2ws/deploy.wsdd
org.apache.axis.utils.Admin would take either "server" or "client" as its argument. "server" is to register the service into server-config.wsdd file, while "client" is to access client-config.wsdd file. I have not yet used this client-config.wsdd file, but I take it as something needed when more setting is needed to client applications.
build-impl.xml file is also to be editted by adding
<target name="deploydirect" depends="init,compile" description="Using Admin">
<j2seproject:java xmlns:j2seproject="http://www.netbeans.org/ns/j2se-project/1"
classname="${main.admin}"><customize>
<arg line="${args.admin}"/>
</customize>
</j2seproject:java>
</target>
Then Register this new target to the menu item of the Free-form project "axiscommandproj" as we have done before. I set the Label as "Deploy directly".
Right-click axiscommandproj node and select "Deploy directly" from the popup menu. It means executing the command
org.apache.axis.utils.Admin server classes/ws2ws/deploy.wsdd
So
We would see the thing we had not seen before.
Yes, we have this time the server-config.wsdd in the directory taken as "Web module"in the project. People suffered from "Unauthorized" attack in Linux would be saved by this way.(I WAS.) I think the difference is that AdminClient is for access to port 8084(or 8080 of standalone Tomcat) this Admin works directly on the working directory.
But notice that the operation "Build Project" -> "Redeploy Project" is needed this time, to copy the content to axisproj\build\web directory and then bundled Tomcat.

This is an example of output by operating "Build Project". You can see the content of E:\nonidata\nb4rcworks\axis\ is copied to E:\nonidata\nb4rcworks\axisproj\build\web, considered as the module really deployed to Tomcat.
It seemed we have reached to the point starting Web Service using WDSL. The final work is creating the client application, also using WDSL.
Assign this work to axisclient project. First, copy ws2.wsdl file in axisproj project to axiscilent, right under the src directory, displayed as "Source Packages/default Package".

Add these properties to nbproject/project.properties file of axisclient project.
![]()
Add a new target to build.xml file.

You can imagine how was exhausted at this point from the uncared indent of some tags....this is for executing WSDL2Java at the client side.
This time the definite working directory, "src" directory of the project, has to be set via Properties window.

It is to locate the files to be created by WSDL2Java under the "src" directory, displayed as "Source Packages" in "Project" window".
And next?....oh, yes. One more project to use this standard project in Free-form, named axisclientcommand...
CREATE IT ANYWAY AT ANY COST! And
register the added target create_client_files to its popup menu with
the label "Create Client Files".So you can execute WSDL2Java at the
client side by right-clicking this project:

Let's go back to axisclient project and check the "Source Packages" node. What has been created?

Yeah! Here they are! No further editing is neede for these Java files, just compile all.
Ummm, it would be nicer to build up a single client app that could switch web services to connect. Let me try some day, this time try to connect to the WDSL Web Service as soon as possible!
ClientTwo to be created is similar to ClientOne, with different method to connect WebService. So I copied Client One at the same package directory, which resulted in ClientOne_1.java, and then used the new Refactoring facility to rename it.

Sorry if you miss the ws2ws package and Java files in the client side project axisclient, please execuse me. I have made many trials with different procedure, in different situation. This screenshot was taken when I had my ClientAppication but not Java files to be created by WDSL2Java.
Set the new name ClintTwo.

So you will see such nice output at the lower part of the IDE Window.

Oh! Do the hustle! Do Refactoring! Clicking the button, so you will get the renamed file with renamed class and constructors. The method getOutputString added to ClassOne.java is also seen in ClassTwo.java, so let's change the content like below:
public String getOutputString(String inputString){
String outputString="";
try{
String endpoint="http://localhost:8084/axis/services/WS2Service";
Service service=new Service();
WS2ServiceSoapBindingStub wsstub=new WS2ServiceSoapBindingStub(new URL(endpoint), service
);
outputString=(String)wsstub.getString2(inputString);}
catch(Exception ex){
outputString=ex.toString();
ex.printStackTrace();
}
return outputString;
}
You can see the way to access to Web Service has been changed.
As for classpath, "AxisLibrary" has been already set at this project,and Java files under ws2ws package like WS2ServiceSoapBindingStub exist in this project so we don't have to worry about it.
Ok, compile this ClientTwo and Run it (Make sure Tomcat is running)
The ClientTwo successfully displayed the response from wsone.jsw Web Service.
I checked the source once again and found ,the ClientOne class called in main method was left not yet renamed.
But WHY INDEED? ...ClientOne_1.java is the one COPIED from ClientOne.java. During this operation, file, only "class and constuctores" was renamed to ClientOne_1 with only one ClientOne class in main method unchanged. And the next renaming was done only for renamed "ClientOne_1". If it were ClientOne that was renamed directly into ClientTwo, all ClientOne word would have been changed, like below:

Is it the fault of NetBeans? or mine?....Anyway, (How many times have I used this word in this page?) correct the main method manually and run!

I am sometimes called Noniki, that's nice, too. Originally I called myself "Roniko", because I like Ronnie James Dio very much! + "ko" is often used for female name in Japan, and a friend of mine made a wrong pronunciation of it, which has been rather preffered because it is easier to pronunciate....IT'S NOT WHAT TO BE DISCUSSED HERE! Anyway, Web Service using WSDL Web Service has been developed successfully with NetBeans4.
....though I cannot stop remembering for NB3.6, with which I did the same thing more easily, directly, without persuading or comproising myself in everything...