blob: 141f229d525dd106e8b3a91f3b465facd51e488a [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--Arbortext, Inc., 1988-2006, v.4002-->
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
"../../dtd/task.dtd">
<task id="twsbeana" xml:lang="en-us">
<title>Creating a Web service from a <tm tmclass="special" tmowner="Sun Microsystems, Inc."
tmtype="tm" trademark="Java">Java</tm> bean using the Apache Axis1 runtime
environment</title>
<titlealts>
<searchtitle>Creating a Web service from a Java bean using the Apache Axis1
runtime environment</searchtitle>
</titlealts>
<shortdesc>The Web Service wizard assists you in creating a new Web service,
configuring it for deployment, and deploying the Web service to a server.
Once your Web service is deployed, the wizard assists you in generating the
client proxy and sample application to test the Web service. When you have
completed testing, you can publish your Web service to a UDDI Business Registry
using the Export wizard.</shortdesc>
<prolog><metadata>
<keywords><indexterm keyref="twsbeana|1|Axis1runtimeenvironmentWebservicesJavabeans"
status="unchanged">Axis runtime environment<indexterm>Web services<indexterm>Java
beans</indexterm></indexterm></indexterm><indexterm keyref="twsbeana|2|WebservicesAxisruntimeenvironmentcreatingaWebservice"
status="unchanged">Web services<indexterm>Axis runtime environment<indexterm>creating
a Web service</indexterm></indexterm></indexterm></keywords>
</metadata></prolog>
<taskbody>
<prereq><p>Prerequisites:<ol>
<li id="createtomcatlink">If you are using the Apache Jakarta Tomcat servlet
container as your server, you must install it, configure an instance of it,
and create a Web project targeted to it as described in <xref href="ttomcatserv.dita"
scope="local">Creating an Apache Tomcat server and Web project</xref></li>
<li>Create or import a bean into the <tm tmclass="special" tmowner="Sun Microsystems, Inc."
tmtype="tm" trademark="Java">Java</tm> source folder of the Web project. To
import, select the <b>Java Resources: src</b> folder, and from the file menu
select <menucascade><uicontrol>Import</uicontrol><uicontrol>General</uicontrol>
<uicontrol>File System</uicontrol></menucascade> and browse to where your
package is.</li>
</ol></p></prereq>
<context>To create a Web service from a bean using the Apache Axis1 runtime
environment:</context>
<steps>
<step><cmd>Switch to the Java EE perspective (<uicontrol>Window > Open Perspective
> Java EE</uicontrol>).</cmd></step>
<step><cmd>In the Project Explorer view, select the bean that you created
or imported into the source folder of your Web project.</cmd></step>
<step><cmd>Click <uicontrol>File > New > Other</uicontrol>.</cmd><info>Select<uicontrol>Web
Services</uicontrol> in order to display the various Web service wizards.
Select the <uicontrol>Web Service</uicontrol> wizard. Click <uicontrol>Next</uicontrol>.</info>
</step>
<step><cmd>Web Services page: select <uicontrol>Bottom up Java bean Web service</uicontrol> as
your Web service type, and enter the URI to the WSDL, WSIL, or HTML file that
will be used to generate the service.</cmd>
<substeps id="createstep4ul">
<substep><cmd>Select the stages of Web services development that you want
to complete using the slider:</cmd><info><ul>
<li>Develop: this will develop the WSDL definition and implementation of the
Web service. This includes such tasks as creating the modules which will contain
the generated code, WSDL files, deployment descriptors, and Java files when
appropriate.</li>
<li>Assemble: this ensures the project that will host the Web service or client
gets associated to an EAR when required by the target application server.</li>
<li>Deploy: this will create the deployment code for the service.</li>
<li>Install: this will install and configure the Web module and EARs on the
target server.</li>
<li>Start: this will start the server once the service has been installed
on it. The server-config.wsdd file will be generated.</li>
<li>Test: this will provide various options for testing the service, such
as using the Web Service Explorer or sample JSPs.</li>
</ul></info></substep>
<substep><cmd>Select your server: the default server is displayed. If you
want to deploy your service to a different server click the link to specify
a different server.</cmd></substep>
<substep><cmd>Select your runtime: the default runtime is displayed. If you
want to deploy your service to a different runtime click the link to specify
a different runtime.</cmd></substep>
<substep><cmd>Select the service project: the project containing the project
selected in your workspace is displayed. To select a different project and
EAR click on the project link.</cmd><info>Ensure that the project selected
as the Client Web Project is different from the Service Web Project, or the
service will be overwritten by the client's generated artifacts.</info></substep>
<substep><cmd>If you want to create a client, select the type of proxy to
be generated and repeat the above steps for the client.</cmd></substep>
<substep><cmd>Publish the Web service: this will launch the Web Services Explorer
to publish your Web service to a UDDI registry.</cmd></substep>
<substep><cmd>Monitor the Web service: this will send the Web service traffic
through the TCP/IP Monitor, which allows you to watch the SOAP traffic generated
by the Web service and to test this traffic for WS-I compliance. Alternately
you can manually set up a TCP/IP monitor as described in <xref href="../../org.eclipse.wst.wsi.ui.doc.user/tasks/tmonitor.dita"
scope="peer">Using the TCP/IP Monitor to test Web services</xref></cmd></substep>
</substeps>
</step>
<step><cmd>Web Service <tm tmclass="special" tmowner="Sun Microsystems, Inc."
tmtype="tm" trademark="Java">Java</tm> Bean Identity page: the Web service
WSDL name will be listed.</cmd><info>You have the following options:<ul>
<li>Select the methods to expose.</li>
<li>Select the encoding style. RPC/Encoded is the recommended encoding style
for the Axis runtime environment. This encoding method is not WS-I compliant.</li>
<li>Select if you want to customize the package to namespace mappings.</li>
</ul>Click <uicontrol>Next</uicontrol></info></step>
<step><cmd>Web Service Package to Namespace Mappings page: if you selected
<uicontrol>Define custom mapping for package to namespace</uicontrol> on
the previous panel, you can enter your custom mapping pairs on this panel
by clicking <uicontrol>Add</uicontrol>. Alternately, you can click <b>Import</b> to
import custom mapping pairs from a <systemoutput>.properties</systemoutput> file.
The content of the properties file must be of the format <codeph><varname>package=namespace</varname></codeph>. </cmd>
<info>You will need to escape some special characters in the properties files.
For example <codeph>somePackage=http://someNamespace</codeph> should be <codeph>somePackage=http\://someNamespace</codeph>.
Otherwise, the colon (:) would be treated as delimiter resulting in trying
to map <codeph>somepackage</codeph> to <codeph>http</codeph>.</info></step>
<step><cmd>Web Service Test page: If you selected to test the Web service,
select the test facility for the generated Web service.</cmd><info>This will
open the Web service in the Web Services Explorer. Select the operation you
want to test, enter the required information, and click<uicontrol>Go</uicontrol>.
The result will display in the Status pane. Click <uicontrol>Next</uicontrol>.</info>
</step>
<step><cmd>Web Service Proxy page: if you have selected to generate a proxy,
select if you want to customize the package to namespace mappings.</cmd></step>
<step><cmd>Web Service Client Test page: Use this page to select the following
options: </cmd>
<substeps>
<substep><cmd>Select your test facility. You can test the generated proxy
in the Web Service Explorer, or you can generate a sample Web service JSP.</cmd>
</substep>
<substep><cmd>If you selected to test the proxy through a JSP, you can select
the folder where the JSP will be located, and you can select the methods that
will be included in the JSP.</cmd></substep>
<substep><cmd>Select <uicontrol>Run test on server</uicontrol> to start the
server for you automatically.</cmd></substep>
</substeps>
</step>
<step><cmd>Web Service Publication page: Select whether or not you want to
publish this Web service to a UDDI registry. Click <uicontrol>Finish</uicontrol>.&nbsp;</cmd>
<info>Note: you may see a warning stating <codeph>Error in generating WSDL
from Java. ClassNotFound: &lt;bean name></codeph>. This error can be safely
ignored.</info></step>
</steps>
<result id="axiswscreateresult"><p>After the Web service has been created,
the following may occur depending on the options you selected: <ul>
<li>If you have selected to test the generated proxy using Web service JSPs,
the proxy is launched in a Web browser at the following URL: http://localhost: <varname>port</varname>/ <varname>WebProject</varname>Client/sample<i
>BeanName</i>/ <varname>WebServiceName</varname>/TestClient.jsp You can use
this sample application to test the Web service by selecting a method, entering
a value for the method, and clicking <uicontrol>Invoke</uicontrol>. The result
of the method will display in the results pane.</li>
<li>If you have selected to test the Web service using the Web Services Explorer,
the Explorer will open. Select the operation you want to test, enter the required
information, and click <b>Go</b>. The result will display in the Status pane.</li>
<li>If you have selected to publish the Web service, the Web Services Explorer
is launched displaying the page required to publish your Web service. Follow
the instructions in <varname>Publishing the Web service</varname> to complete
this task.</li>
</ul></p></result>
<postreq><p> <uicontrol>Important:</uicontrol> If your methods contain types,
not supported by the sample, such as arrays, indexed properties, and collections,
the methods will be omitted from the sample and you will receive a warning
message.</p></postreq>
</taskbody>
<related-links>
<linklist><title>Related Concepts</title>
<link href="../../org.eclipse.jst.ws.doc.user/concepts/cwsinwsa.dita" scope="peer">
<linktext> Tools for Web services development</linktext></link>
<link href="../../org.eclipse.jst.ws.doc.user/concepts/cws.dita" scope="peer">
<linktext>Web services development</linktext></link>
</linklist>
<linklist><title>Related Tasks</title>
<link href="../../org.eclipse.jst.ws.doc.user/tasks/toverws.dita" scope="peer">
<linktext> Developing Web services</linktext></link>
<link href="../../org.eclipse.jst.ws.consumption.ui.doc.user/tasks/tuddiexp.dita"
scope="peer"><linktext> Using the Web Services Explorer</linktext></link>
</linklist>
<linklist><title>Related Reference</title>
<link href="../../org.eclipse.jst.ws.doc.user/ref/rwsdl.dita" scope="peer">
<linktext>WSDL documents</linktext></link>
</linklist>
</related-links>
</task>