Beehive Integration in BEA WebLogic Server

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Build Script Sample - Create Web Service That Uses a Service Control

WARNING: This document is deprecated as of version 10.0 of WebLogic Server. This deprecation warning applies only to this documentation, and not to the underlying functionality it describes nor to the open-source Beehive project. Users who wish to develop and deploy Beehive applications should do so using Workshop for WebLogic, which offers support for all aspects of Beehive technology. Current documentation for integrating Beehive and WebLogic Server can be found at Workshop for WebLogic Platform User's Guide.
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! This build script takes you step by step through creating
!!! a web service application that uses a service control.
!!! It starts with a wsdl and a client jws.
!!! There are three important directories invovled:
!!! src.dir - which is where the source wsdl and jws are located
!!! build.dir - which is used to create build artifacts
!!! deploy.dir - which is the directory that you want to deploy
!!! the ear into.
!!! The build will take place in stages. Each step will be
!!! contributing to an enterprise application directory
!!! within the build.dir.
!!! At the end of the build the entire application will be
!!! built and put into an ear file in the ${build.dir}/deploy
!!! directory.

<project name="serviceControlBuildExample" default="build">

<property environment="env" />
<property name="dev.home" value="${env.DEV_ROOT}" />
<property name="weblogic.home" value="${env.WL_HOME}" />
<property name="jdk.home" value="${env.JAVA_HOME}" />
<property name="" value="${}" />
<import file="${dev.home}/wlw/controls/controls-imports.xml" />
<import file="${dev.home}/wlw/netui/netui-imports.xml" />
<import file="${dev.home}/common/beehive/beehive-imports.xml" />
<import file="${weblogic.beehive.home}/ant/weblogic-beehive-imports.xml" />
<import file="${weblogic.beehive.home}/ant/weblogic-beehive-tools.xml" />
<import file="${weblogic.beehive.home}/ant/weblogic-beehive-buildmodules.xml" />

<!-- this is the source directory -->
<property name="src.dir" location="./src"/>

<!-- this is where things are built into. the ear will wind up in the deploy subdirectory -->
<property name="build.dir" location="C:/tmp"/>

<!-- this is the domain that you wish to deploy your application to -->
<property name="deploy.dir" location="${weblogic.home}/test/scexample/${}/app"/>

<!-- The is where the enterprise application is built into.
<property name="" location="${build.dir}/${}"/>

<!-- this is a temporary directory used frequently for disposable work -->
<property name="temp.dir" location="${build.dir}/work"/>
<delete dir="${temp.dir}"/>

<!-- Setup classpath -->
<property name="temp.lib.dir" value="${build.dir}/templibdir"/>
<mkdir dir="${temp.lib.dir}"/>
<taskdef name="libclasspath" classname="" />
<property name="common.dir" location="${dev.home}/wlw/test/drt/domain/common" />
<property name="deployable.lib.dir" location="${weblogic.home}/common/deployable-libraries" />
<libclasspath tmpdir="${temp.lib.dir}" basedir="${common.dir}" classpathproperty="app.lib.classpath">
<librarydir dir="${deployable.lib.dir}" />
<libclasspath tmpdir="${temp.lib.dir}" basedir="${common.dir}/testjpf" classpathproperty="web.lib.classpath">
<librarydir dir="${deployable.lib.dir}" />
<path id="classpath">
<pathelement path="${app.lib.classpath}" />
<pathelement path="${web.lib.classpath}" />
<pathelement location="${dev.home}/external/junit/junit.jar" />
<pathelement location="${weblogic.home}/server/lib/weblogic.jar" />
<fileset dir="${}/APP-INF/lib" includes="**/*.jar" />
<pathelement path="${}/APP-INF/classes" />

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! This is the primary build script which describes step by step
!!! how to build a jws application that uses a service control.
<target name="build">

<!-- let's initialize the EAR directiry by creating it
!! and seeding it with some initial descriptor files
!! that provide support for controls
<mkdir dir="${}"/>
<mkdir dir="${}/APP-INF/lib"/>
<mkdir dir="${}/APP-INF/classes"/>
<copy todir="${}">
<fileset dir="${src.dir}">
<include name="META-INF/*.xml" />

<mkdir dir="${temp.dir}"/>


<!-- first we need to build the types jar file. This will get
!!! generated right into the where our enterprise
!!! application will be created. All you need is a wsdl!
!!! The output from this step is a types jar file placed
!!! in he /APP-INF/lib of the ear.
<delete dir="${temp.dir}"/>

<!-- next we need to build the actual service control jcx
!!! which will be generated into a work directory
!!! along with the wsdl.
!!! The output from this step is the actual service control
!!! extension (jcx) file placed in the "gensrc" directory.
!!! In this case it is the hellotest.HelloTypesServiceControl.jcx
!!! The WSDL is also placed in the same directory with the
!!! service control extension.
<property name="gen.src.dir" location="${build.dir}/gensrc"/>
<mkdir dir="${gen.src.dir}"/>

<!-- next we will build the control support classes
!!! into the APP-INF/classes directory so
!!! that all apps can take advantage of it.
!!! This could be built into its own jar or
!!! into the client too.
!!! The following files are created and placed in APP-INF/classes
!!! HelloTypesServiceControl.class (interface)
!!! HelloTypesServiceControlBean.class (impl)
!!! HelloTypesServiceControlBean.class.manifest
!!! HelloTypesServiceControlBeanBeanInfo.class
!!! These are all standard controls files
<mkdir dir="${temp.dir}"/>
<mkdir dir="${}/APP-INF/classes"/>
<build-controls srcdir="${gen.src.dir}"
classpathref="classpath" />

Important thing to remember is to move
the wsdl into the same directory as
the service control class.
<copy todir="${}/APP-INF/classes">
<fileset dir="${gen.src.dir}" includes="**/*.wsdl" />
<delete dir="${temp.dir}"/>

<mkdir dir="${build.dir}/module"/>
<mkdir dir="${build.dir}/aptgen"/>
<mkdir dir="${temp.dir}"/>


<!-- The first step is to run apt against the source code to
!!! process the annotations.
!!! The output from this step is source code placed in
!!! the gendir (aptgen) directory which consists of
!!! the HelloTest.jws converted to
!!! and a to help initialize
!!! the service control.
!!! apt also compiles these classes into the destdir...
!!! which in this case is the beginnings of our ejb jar
!!! The following files are created:
!!! HelloTest.class (from source in gendir)
!!! HelloTestClientInitializer.class (from source in gendir)
!!! file to help associate the
!!! service control with the client
<taskdef name="apt"

<apt srcdir="${src.dir}"

<!-- The second step is to build the initial version of
!!! the jws ejb jar. You do this by running jwsc against
!!! the code generated by apt in the aptgen dir.
!!! The output from this step is a jar file called
!!! HelloTest.jar in the dest dir (
!!! and the META-INF/application.xml gets updated
!!! too with a reference to the ejb.
!!! A lot of different things are generated here
!!! to support the
<taskdef name="jwsc"
onerror="report" />

<jwsc srcdir="${build.dir}/aptgen"
debug="on" keepGenerated="true">
<jws file="hellotest/"/>

<!-- The third step is to run controls assembly
!!! on the ejb application to provide the remaining
!!! information needed by the service control.
!!! To do this we unjar the HelloTest.jar into
!!! the "module" directory we created above.
!!! Then we run the assemble-controls task,
!!! compile the new stuff that gets generated
!!! into the module dir.
!!! and then we re-jar the module directory back
!!! into the (ear).
!!! The following artifcats are generated by assembly and
!!! put in the module root:
!!! hellotest/HelloTypesServiceControlJaxRpcMap.xml - 109 bindings file
!!! hellotest/HelloTypesServiceControlServiceClassMemento.ser - runtime info used by the service control
!!! The ejb-jar.xml is updated to contain <service-ref tags that
!!! provide a service reference to the jax-rpc stub with for the
!!! service control.
!!! In the destdir (tempdir) the file
!!! is created which provides the Service Endpoint Interface for JAX-RPC.
!!! This will be compiled next.
<unjar src="${}/hellotest/HelloTest.jar" dest="${build.dir}/module"/>

<!-- we need to build the ServiceEndpointInterface -->
<javac srcdir="${temp.dir}" classpathRef="classpath"
includes="**" />

<!-- we can put the app module back together into a nice jar file -->
<jar jarfile="${}/hellotest/HelloTest.jar" >
<fileset dir="${build.dir}/module" />
<delete dir="${temp.dir}"/>

<!-- The EAR is ready to be packed up...we put it in the deploy dir -->
<mkdir dir="${build.dir}/deploy" />
<jar jarfile="${build.dir}/deploy/${}.ear" >
<fileset dir="${}" />


<target name="deploy">
<echo message="Deploying application ${}" />
<copy file="${build.dir}/deploy/${}.ear" todir="${deploy.dir}" />
<wldeploy action="deploy" source="${deploy.dir}/${}.ear" name="${}" user="weblogic" password="weblogic" verbose="false" adminurl="t3://localhost:7001" debug="false" targets="cgServer" />

<target name="undeploy">
<fail message="The property is not set." unless="" />
<echo message="Undeploying application ${}" />
<wldeploy action="undeploy" name="${}" user="weblogic" password="weblogic" verbose="false" adminurl="t3://localhost:7001" debug="false" targets="cgServer" />

<target name="clean">
<delete dir="${build.dir}"/>


  Back to Top       Previous  Next