Deploying Web Services

# Production Mode Deployment Overview

Weblogic Server can be run in two modes with respect to web services: design mode and production mode.

The default mode of the server is “design mode”, which provides support for iterative development. Your Web Service application source files are stored on disk in exploded directory format. Changes to those source files are dynamically noted by the server and affect the running service. Developers of Web Services should run the server in design mode.

At some point you may want to deploy a Web Service onto a different machine than the one you developed it on. The most common reason for this is to make the service available on a publicly accessible machine, which is usually not a machine that is used for development. Such a machine should run the server in “production mode”, which provides support for applications packaged in a single-file archive (Enterprise Application archive, or EAR). Workshop web services must be packaged as EAR files when deployed on a WebLogic Server running in production mode. It is not possible to modify an application that is running on a production mode server. However, a application can be updated and then replaced on a production mode server.

WebLogic Server and Workshop provide command line tools to perform tasks related to taking a developed application on one machine and deploying it to another. We refer to this process as “production deployment”. These command line tools are:

JwsCompile -- used to generate an EAR that contains all the code for a Web Service application and that can be deployed on another machine.

weblogic.Deployer -- used to deploy an EAR onto a production mode server.

# How To Generate an EAR for a Web Service Application

Let’s say you’ve finished developing a Web Service application and are ready to deploy it to a production mode server. Use the JwsCompile command to generate an EAR for that application. The JwsCompile command has the following syntax:

    JwsCompiler [ -p -app -url -a -x -c -ear -v ] [ <Jws File Name> ]
      -p <Project Directory>      Specify where project sources are.
      -app <Application Name>     Specify the name of the application.
      -a                          Compile all JWS files in project.
      -x <Exclude Jws>            Exclude a Jws from build all.
      -ear <Output EAR file>      Where to put the EAR result.
      <Jws File Name>             The name of the JWS file to compile.

Note: The above list only gives a part of the syntax of JwsCompile. For a full description of the jwsCompile tool see JwsCompile Command in the Reference section.

If the root of your project is C:\bea\weblogic700\samples\workshop\applications\foo, and you wanted to create an EAR for that application called foo.ear, and place that EAR in the directory C:/myEARS/ you would run the following:

JwsCompile –p C:\bea\weblogic700\samples\workshop\applications\foo –a –ear C:\myEARS\foo.ear

JwsCompile produces an EAR that will work for a server running on a particular hostname and port. The default hostname is whatever machine JwsCompile is run on, and the default port is 7001 (WebLogic Server standard). In order to specify that the EAR is to run on a different machine and port, place a configuration file named “weblogic-jws-config.xml" in the project’s WEB-INF directory. Note that the values in weblogic-jws-config.xml can be overridden by specifying appropriate parameters on the command line when running JwsCompile. The following shows sample a weblogic-jws-config.xml file for deploying the web service HelloWorld to a machine named ProductionServer:

    <config>

     <protocol>http</protocol>

     <hostname>ProductionServer</hostname>

     <http-port>7001</http-port>

     <https-port>7002</https-port>

     <jws>

     <class-name>HelloWorld</class-name>

     <protocol>http</protocol>

     </jws>

    </config>

For a complete description of the syntax for weblogic-jws-config.xml see weblogic-jws-config.xml Configuration File in the Reference section.

## How To Start WebLogic Server in Production Mode for Web Services

The mode that the server is running in is determined at startup time. By default, the server runs in “design mode”. To make the server run in “production mode”, include a “production” parameter when calling the startWebLogic script (this has the effect of setting the Java system property “weblogic.jws.ProductionMode=true”). It is also recommended that you include a "nodebug" parameter when starting in production mode. For example, if you have installed WebLogic Server on the C drive, the following command will start WebLogic Server in production mode:

C:\bea\weblogic700\samples\workshop\startWebLogic.cmd production nodebug

Note that running Workshop while WebLogic Server is running in production mode is not recommended.

## How To Deploy a Web Service Application EAR to a Production Mode Server

A server must be running in production mode in order for you to be able to deploy applications to it. Use the weblogic.Deployer command to deploy an EAR to a production mode server. Alternatively, you can deploy using the wizards provided in the WebLogic Server console. See How Do I: Deploy WebLogic Workshop Web Services to a Production Server for instructions on deploying an EAR by either of these methods.

For a complete description of weblogic.Deployer syntax see weblogic.Deployer in the WebLogic Server documentation.

Related Topics

How Do I: Deploy WebLogic Workshop Web Services to a Production Server?