This document assumes that you have
already installed the Web Services Kit for Java 3. If you have not yet
downloaded this product, you may obtain it from the following location:
https://www.borland.com/products/downloads/download_jbuilder.html#
1. File | New Project | Finish
This step created a default project.
2. File | New | General |JavaBean | OK | select the"Generate
Sample Property" checkbox | OK
This step created a basic JavaBean.
3. Right-click the "Bean1.java" in the Project Pane,
and select "Rebuild"
This step rebuilt the JavaBean.
4. Right-click the "Bean1.java" in the Project Pane,
and select "Export class as a Web Service" | Finish
This step created a .wsdl file and all
of the generated classes.
5. File | New | Web Services | SOAP Server | OK | & enter
a name for the Web Service and the directory that you would like to place
it. (ex. Name: Axis, Directory: Axis) | OK | Finish
This step created our Web Services Server
(Tomcat is the default).
6. In the Project Pane, expand the "<name>_generated"
package tree and open the "Bean1ServiceTestCase.java" so that it
is displayed in the Editor.
This step displayed the Service Test Case
in the Editor.
7. In the following method, add the line of code shown below
in bold:
public void test1Bean1ServicePortGetSample()
{
untitled17_generated.Bean1ServicePortType
binding;
try {
binding = new untitled17_generated.Bean1ServiceLocator().getBean1ServicePort();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC
ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
java.lang.String value = null;
value = binding.getSample();
System.out.println(value);
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote
Exception caught: " + re);
}
}
This step will allow the Test Case to output data to
the console for testing.
8. Next, in the Project Pane, expand the Web Node to expose the Index.html
inside the Root directory | Right-click it and choose "Web Run using
Web Services Server"
This step started the Web Services Server.
9. Once the Server has finished starting, in the Project Pane, right-click
the "Bean1ServiceTestCase.java" and choose, "Run Test using
Defaults"
This step started the Service Test Case.
10. Notice in the Message Pane, that under the "Test Heirarchy"
tab (top), you should see all three tests pass (green checkmarks) and if you
switch to the "Test Output" tab (bottom), you should see "Sample"
as the output. This verifies the functionality of the Webb Service, and concludes
this walkthrough.
This step verified that the service worked.
Connect with Us