SyncAsync Sample Readme

Introduction
Intended Audience
Installing the Sample

Set the Prerequisite Environment
Set the Domain Properties
Create the Domain
Tune the Performance Parameters (Optional)
Build the Applications
Create the Database Tables
Start the Server
Deploy the Application

Test the Installation

To Use the IDE

To Modify the Sample Defaults

Sample Installation Sequence (Windows)

Sample Directory Structure
Sample Contents

Introduction

This readme describes the steps to build, deploy, and run the SyncAsync sample. For more information on the SyncAsync sample, see the SyncAsync Sample Description.

For an example of the installation process, see Sample Installation Sequence (Windows).

Note: This sample is provided on dev2dev for your convenience and is not supported by BEA.

Intended Audience

This sample is intended for programmers and advanced users familiar with BEA products, DOS Command Prompt or Unix shell environment, and Ant.

Installing the Sample

The following sections provide step-by-step instructions for installing the sample.

Note: Unzip the sample files into any directory that does not contain spaces in the directory path. For example, you can unzip the files into a directory named c:\sample_files, but not to a directory named c:\sample files. WebLogic Integration and the WLI Common Utilities must also be installed to directories that do not contain spaces.

Set the Prerequisite Environment

Before you begin the installation, open a Command Prompt and follow the steps below to set the environment variables and bootstrap the sample environment. The SyncAsync/scripts/ directory contains bootstrap, ant build files, and the domain properties file. Execute the bootstrap and ant tasks from this directory.

Note: ANT_HOME should be unset. ANT_HOME is not required to run the sample and may produce undesired behavior. The sample automatically uses ant contained in the WebLogic Server installation.

Note: WLST Offline and WLST Online are available for download and evaluation from BEA's dev2dev site, but have not been formally included in the WebLogic Platform 8.1 product. WLST is supported through BEA newsgroups only, and the utility and APIs are subject to change. BEA intends to formally support this capability in a future release of WebLogic Platform.

1.      Set the environment variables as follows:

·         For Windows installations, enter:
set ANT_HOME=
set BEA_HOME=[bea_home] (e.g., C:/bea)
set JAVA_HOME=[java_home] (e.g., %BEA_HOME%/jdk150_11)
set JYTHON_HOME=[jython_home](Default: %BEA_HOME%/wlserver_10.0/common/lib)
set WLI_UTIL_HOME=[wli_util_home] (The location of WLI Common Utilities, e.g., C:/wli_util)
set WL_HOME=[wl_home] (Default:  %BEA_HOME%/wlserver_10.0)

set WLI_HOME=[wl_home] (Default:  %BEA_HOME%/wli_10.2)
set DOMAIN_HOME=[domain_home] (e.g., %BEA_HOME%/user_projects)

set CLIENT_HOME=[client_home] (e.g., C:/SyncAsync)

·         For Unix installations—bash shell, enter:
export ANT_HOME=
export BEA_HOME=[bea_home] (e.g., /export/home/my_bea)
export JAVA_HOME=[java_home] (e.g., $BEA_HOME/jdk150_11)
export JYTHON_HOME=[jython_home] (Default: $BEA_HOME/wlserver_10.0/common/lib)
export WLI_UTIL_HOME=[wli_util_home](The location of WLI Common Utilities, e.g., /export/home/wli_util)
export WL_HOME=[wl_home] (Default:  $BEA_HOME/wlserver_10.0)                                                                   

   export WLI_HOME=[wl_home] (Default:  $BEA_HOME/wli_10.2)

export DOMAIN_HOME=[domain_home] (e.g., /export/home/my_domain_home)

export CLIENT_HOME=[client_home] (e.g., /export/home/SyncAsync)

 

2.      Run the bootstrap as follows:

·         For Windows installations, enter:

bootstrap

This creates the SyncAsync\scripts\env.properties file and sets environment variables.

·         For Unix installations, enter:

. ./bootstrap.sh


This creates the SyncAsync/scripts/env.properties file and sets environment variables.

3.      Set the WLS Environment by entering setWLSEnv.cmd ( or setWLSEnv.sh for Unix).

Set the Domain Properties

By default, the domain user name and password are “weblogic” and “weblogic”.

Note: Use double backslashes (\\) when defining path names in the properties file.

To set the domain properties for a single node domain

Copy the samples domain property file as follows and then modify to suit your needs:

·         For Windows installations, enter:

copy domain.SyncAsync.properties domain.properties

·         For Unix installations, enter:

cp domain.SyncAsync.properties domain.properties

Note: You can configure the domain names (e.g., DOMAIN_HOME/domains/SyncAsync) by editing the domain.name property in the scripts/domain.properties file.

To set the domain properties for a clustered domain

Note: To use this sample in a cluster, the domain must be configured with an Oracle database.

Edit the domain.properties file as follows:

1.      Comment out domain.cluster=single.

2.      Uncomment #domain.cluster=<clustername>.

3.      Replace <clustername> with a valid cluster name without brackets.

4.      Replace the following with valid values for your environment:

domain.cluster.multicast.address=237.0.2.1
domain.cluster.multicast.port=7345
domain.cluster.servers=2

domain.cluster.server1=server1
domain.cluster.server1.address=localhost
domain.cluster.server1.port=8001

domain.cluster.server2=server2
domain.cluster.server2.address=localhost
domain.cluster.server2.port=9001

5.      Based on domain.cluster.servers=<n>, create as many entries of domain.cluster.server<i>, domain.cluster.server<i>.address, and domain.cluster.server<i>.port.

6.      Save the domain.properties file.

Create the Domain

Create the domain by entering:

ant create_domain

 

Note: For clusters only, configure the result callBack queue as a distributed destination. Turn on Server Affinity for the result callBack queue’s JMS Connection Factory so that the response will be from the same server as the request.

Tune the Performance Parameters (Optional)

To tune the performance parameters:

1.      Edit <DOMAIN_HOME>/domains/SyncAsync/setDomainEnv.{sh,cmd} and set the following:

set JAVA_VENDOR=BEA
if "%JAVA_VENDOR%"=="BEA" ( set MEM_ARGS to "-Xms512m -Xmx512m" )

Build the Applications

Building the applications builds ear files for all workshop applications under the apps directory. It also builds the java test client and proxy where applicable.

For this sample to work properly, the client must be generated with the desired URL. In a clustered environment, the URL must specify the router address and port. This URL must be specified in the client/wsdl/AsyncSyncContract.wsdl file before doing running ant build. For more information, see To Create a Clustered Environment.

In the WSDL file client/wsdl/AsyncSyncContract.wsdl, the host and port of your async service’s SOAP address must match the location of the async.sync2JPD. The single node default host and port are localhost:7001. In a cluster, these values must be modified to match the host and port of the router that is specified in domain.properties, as shown in the following example:

<service name="async">

  <port name="asyncSoap" binding="s0:asyncSoap">

    <soap:address

location="http://localhost:7777/sync2AsyncIM/SyncServletWeb/processes/async.sync2JPD"/>

  </port>

</service>

Build the applications and client by entering:

ant build

 

Start the Server

·         For Windows installations:

Start a new command window and enter

%DOMAIN_HOME%\domains\SyncAsync\startWeblogic.cmd

·         For Unix installations:

$DOMAIN_HOME/domains/SyncAsync/startWeblogic.sh &

 

Create the Database Tables

Note: If you are using Oracle, make sure the Oracle server is up and running.

To create the database tables:

1.      Enter:

ant create_app_db_scripts

Note: If you are using PointBase, start the Weblogic server before running the following step.

2.      If you are using PointBase:

·         For Windows, enter:

%DOMAIN_HOME%\domains\SyncAsync\bin\startPointBaseConsole.cmd

·         For Unix, enter:

$DOMAIN_HOME/domains/SyncAsync/bin/startPointBaseConsole.sh

This opens PointBase console window. Connect to the PointBase server by providing following values. Then you can execute the sql content in the next steps 3 and 4 for PointBase.

Jdbc url: jdbc:pointbase:server://localhost:9093/weblogic_eval

User: weblogic

Password: weblogic

3.      Execute the sql script <DOMAIN_HOME>/temp/SyncAsync/appdbscripts.sql. If you are using PointBase, you can copy the sql content into the PointBase console and do execute all.

Deploy the Application

Note: For a clustered domain, make sure that no other managed servers are running except the admin server.

For Windows installations, do the following:

1.      Enter: 

ant deploy

Target deploy in turn calls targets create_app_queues, deploy_egs, and deploy_apps.

Note: At the end of the deployment, a message indicates that the deployment is deferred because no managed server is running. This is normal. Once you stop the admin server and restart with all other managed servers, the resources and the applications will appear.

2.      Stop the domain as follows:

start %DOMAIN_HOME%\domains\SyncAsync\stopWebLogic.cmd weblogic weblogic

3.      Start the server again.

For Unix installations, do the following:

1.      Enter:

ant deploy

Target deploy in turn calls targets create_app_queues, deploy_egs, and deploy_apps.

Note: At the end of the deployment, a message indicates that the deployment is deferred because no managed server is running. This is normal. Once you stop the admin server and restart with all other managed servers, the resources and the applications will appear.

2.      Stop the domain as follows:

$DOMAIN_HOME/domains/SyncAsync/stopWebLogic.sh weblogic weblogic

3.      Start the server again.

Test the Installation

To test the installation from the command line, enter:

ant test

 

If the test is successful you should see something similar to this in the ant command window:

 

     [java] WARNING: Skipping operation[output] clientgen does not support notification or solicit-response WSDL operations yet

     [java] <!-------------------- REQUEST FROM CLIENT ---------------->

     [java] URL        :  http://localhost:7001/sync2AsyncIM/SyncServletWeb/processes/async.sync2JPD

     [java] Headers    :

     [java]   SOAPAction: ["http://www.openuri.org/input"]

     [java]   Content-Type: [text/xml]

 

     [java] <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSch

ema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><en

v:Header xmlns:con="http://www.openuri.org/2002/04/soap/conversation/"><con:StartHeader xmlns:con="http://www.openuri.or

g/2002/04/soap/conversation/"><con:conversationID>192.168.114.207-1989f84.101f0b37811.-8000</con:conversationID></con:St

artHeader></env:Header><env:Body><n1:input xmlns:n1="http://www.openuri.org/"/></env:Body></env:Envelope>

     [java] <!-------------------- END REQUEST FROM CLIENT ------------>

     [java] <!-------------------- RESPONSE TO CLIENT --------------->

     [java] URL           : http://localhost:7001/sync2AsyncIM/SyncServletWeb/processes/async.sync2JPD

     [java] Response Code :200

     [java] Headers       :

     [java]   Date=Tue, 11 Dec 2007 06:41:30 GMT

     [java]   Content-Length=1382

     [java]   Content-Type=text/xml

     [java] Envelope   :

     [java] <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2

001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env

elope/">

     [java] <SOAP-ENV:Header>

     [java] <CallbackHeader xmlns="http://www.openuri.org/2002/04/soap/conversation/">

     [java] <conversationID>192.168.114.207-1989f84.101f0b37811.-8000</conversationID>

     [java] </CallbackHeader></SOAP-ENV:Header>

     [java] <SOAP-ENV:Body>

     [java] <ns:output xmlns:ns="http://www.openuri.org/"><items xmlns="http://bea.com" xsi:schemaLocation="http://bea.c

om/Items.xsd">

     [java]     <item>

     [java]         <id>1</id>

     [java]         <dateStamp>Dec 7, 2007 10:41:31 PM</dateStamp>

     [java]         <displaylabel>Renuka Rishi Mountain Bike</displaylabel>

     [java]         <description>Description of the Renuka Rishi Mountain Bike</description>

     [java]         <type>M</type>

     [java]         <size>21</size>

     [java]         <color>BLUE</color>

     [java]         <baseprice>599.99</baseprice>

     [java]         <manufacturer>uBike</manufacturer>

     [java]         <sku>UBIKE12345MTN</sku>

     [java]         <upc>001234567890</upc>

     [java]         <featuredesc1>More description</featuredesc1>

     [java]         <featuredesc2>Even more description</featuredesc2>

     [java]         <featuredesc3>Yet more description</featuredesc3>

     [java]         <reference1>100</reference1>

     [java]         <reference2>101</reference2>

     [java]         <reference3>102</reference3>

     [java]     </item>

     [java] </items></ns:output></SOAP-ENV:Body>

     [java] </SOAP-ENV:Envelope>

     [java] <!-------------------- END RESPONSE TO CLIENT ----------->

 

 

     [java] -------- Received from asynchronous jpd --------

 

     [java] ******************

     [java] ItemAnonType{ id=<1> dateStamp=<Dec 7, 2006 10:41:31 PM> displaylabel=<Renuka Rishi Mountain Bike> descripti

on=<Description of the Renuka Rishi Mountain Bike> type=<M> size=<21> color=<BLUE> baseprice=<599.99> manufacturer=<uBik

e> sku=<UBIKE12345MTN> upc=<001234567890> featuredesc1=<More description> featuredesc2=<Even more description> featurede

sc3=<Yet more description> reference1=<100> reference2=<101> reference3=<102> custom=<null> }

     [java] ******************

 

 

BUILD SUCCESSFUL

Total time: 8 seconds

To run the application later:

1.      Open a Command Prompt to the sample’s scripts directory.

2.      Set the environment variables.

3.      Run the bootstrap command.

4.      Start the server(s).

5.      Run the application.

To Use the IDE

Workshop is an Eclipse based IDE. You can start Workshop by executing <BEA_HOME>/workshop_10.2/workshop4WP/workshop4WP.exe. You can use the IDE to deploy the application. If you deployed the ear files using ant and try to deploy using IDE again, the deployment will fail. IDE deploys the application as an exploded ear.

To see the application in IDE:

1.      Delete the .metadata and .temp folders from <CLIENT_HOME>/apps.

2.      Set wl.home environment variable to point to <BEA_HOME>/wlserver_10.0.

3.      Open Workshop and point to <CLIENT_HOME>/apps as workspace.

4.      Define WLI_HOME as a variable in Workshop and point it to <BEA_HOME>/wli_10.2( Window->Preferences->Java-> Build Path->Classpath Variables->New button )

5.      Use File->Import->Existing projects into Workspace and point to the <CLIENT_HOME>/apps folder.

To use the IDE to run the sample:

1.      Open the SyncServlet application in WebLogic Workshop.

2.      In the SyncClient project, start Controller.jpf.
The request.jsp page entitled "Calling a BEA WebLogic Integration Asynchronous Business Process From a Synchronous Client” will load.

3.      At the bottom of that page, click the "Request a message from an asynchronous BEA WebLogic Integration business process" link to invoke the asynchronous business process.

4.      After selecting this link, the response.jsp page entitled "Message Content from the BEA WebLogic Integration Asynchronous Business Process" will load and display an XML nodeset selection from the response object. 

5.       To continue to run the sample, either refresh the Workshop Test Browser window or use the "Re-run this sample" link on the response.jsp page.

A separate java test client is available as an ant target.

To Modify Sample Defaults

No defaults other than the domain properties are available.

Sample Installation Sequence (Windows)

To build the applications, create the domain, deploy, and configure:

set CLIENT_HOME=[client_home]

set WLI_HOME=[WLI_home]

 

To start the server every time after that, enter:

pushd %DOMAIN_HOME%\domains\SyncAsync
start cmd /c startWeblogic
popd

Sample Directory Structure

SyncAsync

 ├───apps

    └───SyncServlet

        ├───EarContent

          └───APP-INF

                └───lib

        ├───SyncClient

           ├───controls

           ├───resources

           └───WEB-INF

        ├───Schemas

           └───system

        └───SyncServletWeb

            ├───processes

            └───WEB-INF

 ├───client

    └───wsdl

       

 ├───lib

    ├───com

    ├───javax

    ├───META-INF

    ├───org

    └───websvc

 

 └───scripts

 

Sample Contents

The sample consists of the following files:

Application - SyncAsync

Page Flow Project - SyncClient

SyncClient/request.jsp

- Presents a page containing a link to invoke the syncAsyncXMLBean.jpd

SyncClient/response.jsp

- Displays the received XMLBean response object rendered via a NetUI repeater tag
- Displays a link to rerun the sample

SyncClient/Controller.java

- Controls JSP actions and flow
- Stores the response object in a form bean

SyncClient/controls/asyncSyncControl.java

- Web Service Control generated from the asyncSyncContract.wsdl in the SyncServletWeb process project
- Used in the page flow project to call the jpd.

SyncClient/controls/asyncSync.wsdl

- This WSDL is a copy of the asyncSyncContract.wsdl in the SyncServletWeb process project. It is created in this location by WebLogic Workshop when a web service control is created from the SyncAsync process project’s processes/asyncSyncContract.wsdl

  

Process Project - SyncServletWeb

processes/async.java

- Accepts a SOAP/HTTP request
- Timer Control waits 1 second (arbitrary asynchronous activity)
- Creates response XMLBean object (with fixed elements and unique timestamp)
- Returns the response object

processes/asyncSyncContract.wsdl

- Synchronous WSDL for the jpd, generated by selecting “Generate Sync/Async WSDL File” from the jpd popup menu

 

Schemas Project

Schemas/Items.xsd

- Schema for the bicycle response object