WebSphere Application Server - Use ANT to deploy webservice to WebSphere 5.xx

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > March 2004 > Use ANT to deploy webservice to WebSphere 5.xx





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Use ANT to deploy webservice to WebSphere 5.xx
Stas1976

2004-03-23, 12:37 pm

I feel difficulties to deploy WebService to WAS without having WSAD or Eclipse (with WSDK_51 plugin). I want to use ANT script to build my Java code and create WebService wrapper for the Java bean class. The best choice is to have special ANT task or in w
orse scenario a command line utility. BEA provides ANT tasks for WebLogic that makes WS deployment an easiest task but it seems that IBM does not have any tool to automatically build a deploy WebServices. WS Application server is provided with few command
line utilities that can generate some deployment files but it is necessary to correct these files by hand afterwards. WSDK_v51 also contains some utilities but it is extremely difficult (if is possible) to force them to generate WebService wrapper from A
NT script. So my point that WebSphere has pretty limited web services development support. Is it true or I missed something?
Ken Hygh

2004-03-23, 4:34 pm

Stas1976 wrote:

>I feel difficulties to deploy WebService to WAS without having WSAD or Eclipse (with WSDK_51 plugin). I want to use ANT script to build my Java code and create WebService wrapper for the Java bean class. The best choice is to have special ANT task or in

worse scenario a command line utility. BEA provides ANT tasks for WebLogic that makes WS deployment an easiest task but it seems that IBM does not have any tool to automatically build a deploy WebServices. WS Application server is provided with few comman
d line utilities that can generate some deployment files but it is necessary to correct these files by hand afterwards. WSDK_v51 also contains some utilities but it is extremely difficult (if is possible) to force them to generate WebService wrapper from
ANT script. So my point that WebSphere has pretty limited web services development support. Is it true or I missed something?
>
>

WebSphere has extensive web services development support. It's called
WebSphere Studio Application Developer. If you don't want to use that
tool, then you're pretty much on your own.

Ken

Stas1976

2004-03-23, 7:35 pm

I use to for IBM 2.5 years. And off course I know this tool and have big ex=
perience of using it. Problem is that I don=92t work for IBM right now. My =
new company is considering the different application servers to be a produc=
tion environment for our health insurance software. The development price i=
s very valuable argument. So WSAD installation price is about 5-6K per inst=
allation. Company by some reason could not afford this price. But it seems =
that we have not got an alternatives except using WebLogic in this particul=
ar case. Believe it or not =96 I really want to stick with WAS but unfortun=
ately it is impossible because total price of Development tools and product=
ion servers is to high for my bosses. If I can create ANT script that could=
be run in the Netbeans it helps me to convince them to choose WAS instead =
of WebLogic.
Stas1976

2004-03-23, 8:34 pm

Eventually I created ANT script using examples in WAS installation but it was difficult just to make life easy to other developers (that are not so lucky to have WSAD) I put key parts of this script here. You also need to add wsanttasks.jar and webservice
s.jar (from websphere/appserver/lib) to you ANT/lib folder before then run ANT script

<taskdef name="EndpointEnablerTask" classpath="${WS_CLASSPATH}" classname="com.ibm.websphere.ant.tasks.endptEnabler"/>
<taskdef name="WSDL2JavaTask" classpath="${WS_CLASSPATH}" classname="com.ibm.websphere.ant.tasks.WSDL2Java"/>
<taskdef name="Java2WSDLTask" classpath="${WS_CLASSPATH}" classname="com.ibm.websphere.ant.tasks.Java2WSDL"/>

<!-- GENERATE-WSDL -->
<target name="generate-wsdl"
description="Runs wsdltool to generate the WSDL file">
<echo message="GENERATE WSDL"/>
<echo message="------------------------------------------"/>
<tstamp/>
<Java2WSDLTask output="${WEBINF_FOLDER}/wsdl/${APPLICATION_NAME}.wsdl"
className = "${WS_CLASS_NAME}"
implClass = "${WS_INTERFACE_NAME}"
namespace = "${WS_NAMESPACE}"
location = "http://localhost:9080/${APPLICATION_NAME}/${WS_SERVICE_CONTEXT}/${WS_PORT}"
style = "document"
use = "literal" >
<mapping namespace = "${WS_NAMESPACE}"
package = " ${WS_PACKAGE}"/>
</Java2WSDLTask>

</target>


<!-- GENERATE-DEPLOYMENT CODE -->
<target name="generate-deploy-code"
description="Runs wsdltool to generate the WSDL file">
<echo message="GENERATE DEPLOYMENT FILES"/>
<echo message="------------------------------------------"/>
<echo message="Emiting development files..."/>
<WSDL2JavaTask
url = "${WEBINF_FOLDER}/wsdl/${APPLICATION_NAME}.wsdl"
output = "${WEB_FOLDER}"
role = "develop-server"
container = "web"
genjava = "no"
verbose = "false">
</WSDL2JavaTask>

<!-- Fill in the servlet-name of the servlet-link attribute in the generated webservices.xml -->
<echo message=""/>
<echo message="Fill in the servlet-name ..."/>
<replace
file="${WEBINF_FOLDER}/webservices.xml"
token="??SET THIS TO servlet-name ELEMENT OF web.xml??"
value="${SERVLET_NAME} ">
</replace>

<echo message=""/>
<echo message="Generate deployment files..."/>
<WSDL2JavaTask url = "${WEBINF_FOLDER}/wsdl/${APPLICATION_NAME}.wsdl"
output = "${SOURCE_FOLDER}"
role = "deploy-server"
container = "web"
genjava = "overwrite"
verbose = "false">
</WSDL2JavaTask>

<!-- Compile a 2nd time to get the serializers -->
<echo message=""/>
<echo message="Compile a 2nd time to get the serializers..."/>
<javac srcdir = "${SOURCE_FOLDER}"
destdir = "${WEBINF_FOLDER}/classes"
deprecation = "true"
debug = "on"
classpath = "${WS_CLASSPATH}"/>
</target>


<!-- PACKAGE-SERVICE -->
<target name="package_service" description="Packages the WAR file">
<echo message="PACKAGE SERVICE"/>
<echo message="------------------------------------------"/>

<jar jarfile="${DISTRIBUTION_FOLDER}/${WAR_FILE}" >
<fileset dir="${WEB_FOLDER}"/>
</jar>

<ear destfile ="${DISTRIBUTION_FOLDER}/${EAR_FILE}"
appxml ="${J2EE_FOLDER}/META-INF/application.xml" >
<fileset dir="${DISTRIBUTION_FOLDER}" includes="*.jar,*.war"/>
</ear>

<echo message="Running EndpointEnabler on WebServicesSamples.ear..."/>
<EndpointEnablerTask earfile="${DISTRIBUTION_FOLDER}/${EAR_FILE}">
<property key="ReportService.http.routerModuleName" value="${WAR_FILE}"/>
<property key="ReportService.http.contextRoot" value="/${WS_PORT}"/>
</EndpointEnablerTask>

</target>.

Stas1976

2004-03-23, 8:34 pm

Eventually I created ANT script using examples in WAS installation but it was difficult just to make life easy to other developers (that are not so lucky to have WSAD) I put key parts of this script here. You also need to add wsanttasks.jar and webservice
s.jar (from websphere/appserver/lib) to you ANT/lib folder before then run ANT script
<pre>
<taskdef name="EndpointEnablerTask" classpath="${WS_CLASSPATH}" classname="com.ibm.websphere.ant.tasks.endptEnabler"/>
<taskdef name="WSDL2JavaTask" classpath="${WS_CLASSPATH}" classname="com.ibm.websphere.ant.tasks.WSDL2Java"/>
<taskdef name="Java2WSDLTask" classpath="${WS_CLASSPATH}" classname="com.ibm.websphere.ant.tasks.Java2WSDL"/>

<!-- GENERATE-WSDL -->
<target name="generate-wsdl"
description="Runs wsdltool to generate the WSDL file">
<echo message="GENERATE WSDL"/>
<echo message="------------------------------------------"/>
<tstamp/>
<Java2WSDLTask output="${WEBINF_FOLDER}/wsdl/${APPLICATION_NAME}.wsdl"
className = "${WS_CLASS_NAME}"
implClass = "${WS_INTERFACE_NAME}"
namespace = "${WS_NAMESPACE}"
location = "http://localhost:9080/${APPLICATION_NAME}/${WS_SERVICE_CONTEXT}/${WS_PORT}"
style = "document"
use = "literal" >
<mapping namespace = "${WS_NAMESPACE}"
package = " ${WS_PACKAGE}"/>
</Java2WSDLTask>

</target>


<!-- GENERATE-DEPLOYMENT CODE -->
<target name="generate-deploy-code"
description="Runs wsdltool to generate the WSDL file">
<echo message="GENERATE DEPLOYMENT FILES"/>
<echo message="------------------------------------------"/>
<echo message="Emiting development files..."/>
<WSDL2JavaTask
url = "${WEBINF_FOLDER}/wsdl/${APPLICATION_NAME}.wsdl"
output = "${WEB_FOLDER}"
role = "develop-server"
container = "web"
genjava = "no"
verbose = "false">
</WSDL2JavaTask>

<!-- Fill in the servlet-name of the servlet-link attribute in the generated webservices.xml -->
<echo message=""/>
<echo message="Fill in the servlet-name ..."/>
<replace
file="${WEBINF_FOLDER}/webservices.xml"
token="??SET THIS TO servlet-name ELEMENT OF web.xml??"
value="${SERVLET_NAME} ">
</replace>

<echo message=""/>
<echo message="Generate deployment files..."/>
<WSDL2JavaTask url = "${WEBINF_FOLDER}/wsdl/${APPLICATION_NAME}.wsdl"
output = "${SOURCE_FOLDER}"
role = "deploy-server"
container = "web"
genjava = "overwrite"
verbose = "false">
</WSDL2JavaTask>

<!-- Compile a 2nd time to get the serializers -->
<echo message=""/>
<echo message="Compile a 2nd time to get the serializers..."/>
<javac srcdir = "${SOURCE_FOLDER}"
destdir = "${WEBINF_FOLDER}/classes"
deprecation = "true"
debug = "on"
classpath = "${WS_CLASSPATH}"/>
</target>


<!-- PACKAGE-SERVICE -->
<target name="package_service" description="Packages the WAR file">
<echo message="PACKAGE SERVICE"/>
<echo message="------------------------------------------"/>

<jar jarfile="${DISTRIBUTION_FOLDER}/${WAR_FILE}" >
<fileset dir="${WEB_FOLDER}"/>
</jar>

<ear destfile ="${DISTRIBUTION_FOLDER}/${EAR_FILE}"
appxml ="${J2EE_FOLDER}/META-INF/application.xml" >
<fileset dir="${DISTRIBUTION_FOLDER}" includes="*.jar,*.war"/>
</ear>

<echo message="Running EndpointEnabler on WebServicesSamples.ear..."/>
<EndpointEnablerTask earfile="${DISTRIBUTION_FOLDER}/${EAR_FILE}">
<property key="ReportService.http.routerModuleName" value="${WAR_FILE}"/>
<property key="ReportService.http.contextRoot" value="/${WS_PORT}"/>
</EndpointEnablerTask>

</target>
</pre>

Ken Hygh

2004-03-24, 10:38 am

Stas1976 wrote:

>Eventually I created ANT script using examples in WAS installation but it was difficult just to make life easy to other developers (that are not so lucky to have WSAD) I put key parts of this script here. You also need to add wsanttasks.jar and webservic

es.jar (from websphere/appserver/lib) to you ANT/lib folder before then run ANT script
>
>
>


Thanks for posting this. I know lots of developers are using Ant to do
builds.

Ken

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com