| <!-- | 
 |  | 
 |     Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. | 
 |  | 
 |     This program and the accompanying materials are made available under the | 
 |     terms of the Eclipse Public License v. 2.0, which is available at | 
 |     http://www.eclipse.org/legal/epl-2.0. | 
 |  | 
 |     This Source Code may also be made available under the following Secondary | 
 |     Licenses when the conditions for such availability set forth in the | 
 |     Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | 
 |     version 2 with the GNU Classpath Exception, which is available at | 
 |     https://www.gnu.org/software/classpath/license.html. | 
 |  | 
 |     SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | 
 |  | 
 | --> | 
 |  | 
 | <!DOCTYPE project [ | 
 |   <!ENTITY jaxrpctargets SYSTEM "../common/targets.xml"> | 
 |   <!ENTITY commonSetup SYSTEM "file:./../../../config/properties.xml"> | 
 |   <!ENTITY commonBuild SYSTEM "file:./../../../config/common.xml"> | 
 |   <!ENTITY testproperties SYSTEM "file:./build.properties"> | 
 | ]> | 
 |  | 
 | <project name="jaxrpc-hello-web" default="all" basedir="."> | 
 |  | 
 |   <property name="appname" value="MyHelloService"/> | 
 |  | 
 |   <property environment="env" /> | 
 |  | 
 |   <property file="${env.APS_HOME}/config.properties"/> | 
 |   <property file="samplebuild.properties"/> | 
 |  | 
 |   &jaxrpctargets; | 
 |   &commonSetup; | 
 |   &commonBuild; | 
 |   &testproperties; | 
 |  | 
 |   <path id="class.path"> | 
 |         <fileset dir="${env.S1AS_HOME}/modules"> | 
 |             <include name="**/*.jar"/> | 
 |         </fileset> | 
 |         <fileset dir="${env.S1AS_HOME}/modules/endorsed"> | 
 |             <include name="**/*.jar"/> | 
 |         </fileset> | 
 |         <fileset dir="${env.APS_HOME}/lib"> | 
 |             <include name="**/*.jar"/> | 
 |         </fileset> | 
 |  | 
 |     </path> | 
 |  | 
 |   <target name="all" depends="clean,deploy,assemble-client,deploy-client,runtest,undeploy"/> | 
 |    | 
 |  | 
 |   <target name="create-war" description="Packages the WAR file"> | 
 |      <echo message="Creating the WAR...."/> | 
 |      <delete file="${assemble.war}/${war.file}" /> | 
 |      <delete dir="${assemble.war}/WEB-INF" /> | 
 |      <copy todir="${assemble.war}/WEB-INF/classes/"> | 
 |          <fileset dir="${build}/"  | 
 |                   includes="**/*.class"  | 
 |                   excludes="**/*Client.class, **/*.wsdl, **/*mapping.xml"/> | 
 |      </copy> | 
 |      <copy file="${build}/MyHelloService.wsdl" todir="${assemble.war}/WEB-INF/wsdl" /> | 
 |      <copy file="${build}/mapping.xml" todir="${assemble.war}/${build}/" /> | 
 |      <copy file="sun-web.xml" todir="${assemble.war}/WEB-INF" /> | 
 |      <copy file="webservices.xml" todir="${assemble.war}/WEB-INF" /> | 
 |      <war destfile="${assemble.war}/${war.file}"  | 
 |           webxml="./web.xml" filesonly="true" > | 
 |        <fileset dir="${assemble.war}" includes="WEB-INF/**, build/**" /> | 
 |      </war> | 
 |      <copy file="${assemble.war}/${war.file}" todir="." /> | 
 |   </target> | 
 |  | 
 |   <target name="build" depends="build-service" | 
 |      description="Executes the targets needed to build the service."> | 
 |   </target> | 
 |  | 
 |   <target name="deploy" depends="set-asadmin,build,create-war"> | 
 |       <echo message="Deploying ${war.file} from ${basedir}." level="verbose"/> | 
 |       <exec executable="${ASADMIN}"> | 
 |         <arg line="deploy"/> | 
 |         <arg line="--user ${admin.user}"/> | 
 |         <arg line="--passwordfile ${admin.password.file}"/> | 
 |         <arg line="--host ${admin.host}"/> | 
 |         <arg line="--port ${admin.port}"/> | 
 |         <arg line="${war.file}"/> | 
 |       </exec> | 
 |     </target> | 
 |  | 
 |  | 
 |  | 
 |    <target name="undeploy-war1" depends="init-common"> | 
 |       <echo message="Undeploying ${war.file} from ${basedir}." level="verbose"/> | 
 |       <exec executable="${ASADMIN}"> | 
 |         <arg line="undeploy"/> | 
 |         <arg line="--user ${admin.user}"/> | 
 |         <arg line="--passwordfile ${admin.password.file}"/> | 
 |         <arg line="--host ${admin.host}"/> | 
 |         <arg line="--port ${admin.port}"/> | 
 |         <arg line="${warname}"/> | 
 |       </exec> | 
 |     </target> | 
 |   | 
 |  | 
 |  <!-- <target name="build-client" depends="build-static" | 
 |      description="Executes the targets needed to build a static stub client."> | 
 |   </target> | 
 |  | 
 |   <target name="runclient1" depends="run-client" | 
 |      description="Runs the client."> | 
 |   </target> | 
 |  | 
 |   <target name="run-client" | 
 |      description="Runs a stand-alone (non-J2EE) client"> | 
 |       <java classname="${client.class}" fork="yes" > | 
 |         <arg line="${endpoint.address}" /> | 
 |         <classpath refid="run.classpath" /> | 
 |     </java> | 
 |   </target> | 
 |  | 
 |  | 
 |   <target name="generate-client-stubs" | 
 |       description="Runs wscompile to generate the client stub classes"> | 
 |     <antcall target="run-wscompile"> | 
 |       <param name="param1" value="-gen:client -d ${build.classes.dir} -keep -s ${build.classes.dir} -classpath ${build.classes.dir} ${config.wsdl.file}"/> | 
 |     </antcall> | 
 |   </target> | 
 |  | 
 |     <target name="assemble-client" depends="init-common,generate-client-stubs"> | 
 |     <antcall target="compile-common"> | 
 |         <param name="src" value="client"/> | 
 |     </antcall> | 
 |     <mkdir dir="${build.classes.dir}/META-INF/wsdl"/> | 
 |     <copy file="${assemble.war}/WEB-INF/wsdl/MyHelloService.wsdl" todir="${build.classes.dir}/META-INF/wsdl"/>     | 
 |     <unjar src="${env.APS_HOME}/lib/reporter.jar" | 
 |         dest="${build.classes.dir}"/> | 
 |     <antcall target="appclient-jar-common"> | 
 |       <param name="appclientjar.classes" | 
 |              value="mapping.xml,META-INF/wsdl/**,helloservice/**,com/**" /> | 
 |     </antcall> | 
 |  | 
 |         <antcall target="deploy-client-common"/> | 
 |         <move file="${assemble.dir}/${appname}-client.jar" toFile="${assemble.dir}/${appname}AppClient.jar"/> | 
 |   </target> | 
 |  | 
 |      <target name="run" depends="init-common,assemble-client"> | 
 |         <antcall target="runclient-common"> | 
 |           <param name="appclient.application.args" value="http://${http.host}:${http.port}/hello-jaxrpc/hello"/> | 
 |         </antcall> | 
 |     </target>      --> | 
 |  | 
 |     <target name="assemble-client" depends="init-common"> | 
 |              <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/> | 
 |              <antcall target="run-wscompile"> | 
 |               <param name="param1" value="-gen:client -d ${build.classes.dir}/webclient/WEB-INF/classes -keep -s ${build.classes.dir}/webclient/WEB-INF/classes -classpath ${build.classes.dir}/webclient/WEB-INF/classes ${config.wsdl.file}"/> | 
 |              </antcall> | 
 |              <replace file="webclient/Client.java" value="${http.host}" token="HTTP_HOST"/> | 
 |              <replace file="webclient/Client.java" value="${http.port}" token="HTTP_PORT"/> | 
 |  | 
 |              <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes" | 
 |                    includes="webclient/**"> | 
 |                 <classpath refid="class.path"/> | 
 |              </javac> | 
 |              <copy file="client-web.xml" tofile="${build.classes.dir}/webclient/WEB-INF/web.xml"/> | 
 |              <copy file="build/mapping.xml" tofile="${build.classes.dir}/webclient/WEB-INF/hello-mapping.xml"/> | 
 |              <copy file="build/MyHelloService.wsdl" tofile="${build.classes.dir}/webclient/WEB-INF/wsdl/hello.wsdl"/> | 
 |              <copy file="config-wsdl.xml" tofile="${build.classes.dir}/webclient/WEB-INF/hello-config.xml"/> | 
 |  | 
 |  | 
 |  | 
 |  | 
 |              <copy file="client-sun-web.xml" tofile="${build.classes.dir}/webclient/WEB-INF/sun-web.xml"/> | 
 |             <mkdir dir="${assemble.dir}"/> | 
 |              <jar destfile="${assemble.dir}/wsclient.war" basedir="${build.classes.dir}/webclient" includes="**"/> | 
 |            </target> | 
 |  | 
 |            <target name="deploy-client" depends="init-common"> | 
 |              <property name="client.war" value="${assemble.dir}/wsclient.war"/> | 
 |              <echo message="Deploying wsclient.war from ${assemble.dir}." level="verbose"/> | 
 |              <exec executable="${ASADMIN}"> | 
 |                <arg line="deploy"/> | 
 |                <arg line="--user ${admin.user}"/> | 
 |                <arg line="--passwordfile ${admin.password.file}"/> | 
 |                <arg line="--host ${admin.host}"/> | 
 |                <arg line="--port ${admin.port}"/> | 
 |                <arg line="${client.war}"/> | 
 |              </exec> | 
 |            </target> | 
 |  | 
 |        <target name="undeploy-client" depends="init-common"> | 
 |            <exec executable="${ASADMIN}"> | 
 |              <arg line="undeploy"/> | 
 |              <arg line="--user ${admin.user}"/> | 
 |              <arg line="--passwordfile ${admin.password.file}"/> | 
 |              <arg line="--host ${admin.host}"/> | 
 |              <arg line="--port ${admin.port}"/> | 
 |              <arg line="wsclient"/> | 
 |            </exec> | 
 |          </target> | 
 |  | 
 |        <target  name="undeploy" depends="undeploy-war1,undeploy-client"/> | 
 |      | 
 |        <target name="runtest" depends="init-common"> | 
 |              <mkdir dir="${build.classes.dir}/client"/> | 
 |              <javac srcdir="." destdir="${build.classes.dir}/client" | 
 |                    classpath="${env.APS_HOME}/lib/reporter.jar" | 
 |                    includes="client/**"/> | 
 |              <unjar src="${env.APS_HOME}/lib/reporter.jar" dest="${build.classes.dir}/client"/> | 
 |              <java classname="client.TestClient"> | 
 |                <classpath> | 
 |                  <pathelement path="${build.classes.dir}/client"/> | 
 |                </classpath> | 
 |                <arg value="http://${http.host}:${http.port}/wsclient/RequestProcessor"/> | 
 |              </java> | 
 |  | 
 |  | 
 |           <!--restore the tokens back in file--> | 
 |          <replace file="webclient/Client.java" token="${http.host}" value="HTTP_HOST"/> | 
 |          <replace file="webclient/Client.java" token="${http.port}" value="HTTP_PORT"/> | 
 |            </target> | 
 |  | 
 |  | 
 |  | 
 |  | 
 | </project> |