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

You can use the following procedures to deploy web services built with WebLogic Workshop to production computers installed with WebLogic Server. This task is divided into two steps to compile your web application as an EAR file and steps to deploy the EAR file on a production server.

To Compile a Web Application as an EAR File

1. Modify the weblogic-jws-config.xml file in your project's WEB-INF directory. The contents of this file should specify the <hostname>, which should match the name of the production machine to which the service will be deployed. The global <protocol> tag, which is the immediate child of the <config> tag, specifies the protocol over which the application as whole should be exposed. The <protocol> tag which is the immediate child of the <jws> tag specifies the protocol over which individual web services should be exposed. Valid values for the global and jws-specific <protocol> tags are http or https.
   The following example shows the configuration of a web application containing two web services. One web service, HelloWorld, is to be exposed on the http protocol; the other web service, HelloWorldSecure, is to be exposed on the https protocol:

    <config>
     <protocol>http</protocol>
     <hostname>myProductionMachine</hostname>
     <http-port>7001</http-port>
     <https-port>7002</https-port>
     <jws>
      	<class-name>HelloWorld</class-name>
      	<protocol>http</protocol>
     </jws>
     <jws>
      	<class-name>HelloWorldSecure</class-name>
      	<protocol>https</class-name>
     </jws>
    </config>

2. Compile your web application as an EAR file. To compile an application as an EAR use the command line tool jwsCompile, supplied by WebLogic Workshop. For example, suppose you have a project called Hello, which contains one web service called HelloWorld. The following command will compile the project as an EAR file, assuming that you run jwsCompile from the Hello project's project directory C:\bea\weblogic700\samples\workshop\applications\Hello\

    jwsCompile -a -p . -ear HelloWorld.ear

To Deploy the EAR File on a Production Server

1. Confirm that there is no application already deployed on the production machine with the same name as the application from which you generated the EAR file. To confirm that there is no such application, visit the WebLogic Server console on the production machine. Undeploy any applications with the same name as the application you are planning to deploy.
   If you are developing and deploying on the same machine, verify that the EJBs generated while running WebLogic Workshop in development mode are removed as well. To remove the EJB's, manually edit config.xml (found at BEA_HOME/weblogic700/samples/workshop/) to remove any references to the appropriate EJB's. If the EJB's are already present, deployment will generate an instance already exists exception

2. Start WebLogic Server in production mode. To start WebLogic Server in production mode, run the following
   BEA_HOME\weblogic700\samples\workshop\startWeblogic.cmd production nodebug

3. On the development machine, deploy the EAR file to the production machine by using the WebLogic Server tool weblogic.Deployer. To use the weblogic.Deployer tool make sure that weblogic.jar is in your classpath. For example, the following command deploys the EAR file HelloWorld.ear to the production server myProductionServer:
   C:\>java weblogic.Deployer -adminurl http://myProductionServer:7001 -password installadministrator -source C:\EARS\HelloWorld.ear -targets cgServer -name HelloWorld -activate -upload

Alternatively, you can use the console of the production machine to deploy the EAR file.

1. Start WebLogic Server in production mode. To start WebLogic Server in production mode, run the following BEA_HOME\weblogic700\samples\workshop\startWeblogic.cmd production nodebug

2. In a web browser visit the console page:
   http://localhost:7001/console

3. When prompted for a password, enter installadministrator.

4. In the directories displayed on the left side of the screen, navigate to Deployments/Applications, and right click on the Applications directory. Select "Configure a new Application...".

5. In Step 1, click the link "upload it through your browser".

6. Click the Browse... button and navigate to the EAR file you wish to deploy, then click Upload.

7. In Step 2, select the application you would like to deploy.

8. In Step 3, select the target servers from the available servers.

9. In Step 4, confirm the name of the application.

10. In Step 5, click "Configure and Deploy".

11. Finally, click "Deploy Application".