Accessibility
 
Home > Products > JRun > Support > Web Services
Macromedia JRun Support Center - Web Services
Publishing a web service in JRun

You can publish Java classes and stateless session beans as web services. You can also publish the source file of a Java class as a web service by replacing its java file extension with the extension jws; this type of web service is called an Axis Java Web Service (JWS).

To publish a web service for a Java class or EJB:

1 Create an XML-based web services deployment descriptor named server-config.wsdd (WSDD file), containing a service element based on the target Java class or stateless session bean. For JWS files, you do not need to configure a service element in a server-config.wsdd file, but the web application that contains the JWS must include a minimal server-config.wsdd file so that JRun automatically creates an Axis engine.
The JRun web service sample application on the samples JRun server provides WSDD snippets and a complete WSDD example.
A typical service element for a regular Java class looks like this:
<service name="AxisSampleLoanCalcService" provider="java:RPC">
  <parameter name="allowedMethods" value="calculate echoLoanInfoArray"/>
  <parameter name="className" value="samples.Loan"/>
</service>
A typical service element for a stateless session bean looks like this:
<service name="AxisSampleLoanEjbService" provider="java:EJB">
  <parameter name="allowedMethods" value="calculate"/>
  <parameter name="jndiPassword" value="AxisPassword"/>
  <parameter name="beanJndiName" value="java:sample_ws.SampleLoanEjbHome"/>
  <parameter name="homeInterfaceName" value="ejbeans.SampleLoanHome"/>
  <parameter name="jndiUser" value="AxisUser"/>
 </service>
2 Assemble a standard J2EE web application module.
3 Copy the server-config.wsdd file to the web application's WEB-INF directory.
4 If you are assembling a JWS web service, copy the JWS file to the web application root directory or a subdirectory other than WEB-INF or META-INF.
If you are assembling a class-based web service (not an EJB-based service), copy the target Java class file to the web application's WEB-INF/classes directory.
If you are assembling an EJB-based web service, assemble an enterprise application that contains the web application and the EJB.
5 Deploy the web or enterprise application. You can deploy J2EE modules in expanded directories or archive files.
The previous steps provide a very simple scenario. Axis is a very flexible and extensible web services engine, which lets you easily deal with such things as complex data types and security. For more information about publishing web services in JRun, see JRun Programmer's Guide in the JRun 4 installation.

To Table of Contents Back to Previous document Forward to next document