I had done a sample web service project in eclipse europa with the glassfish server integrated. This program invokes a web service via
Java Since it is using the new spec JAX-WS and not the AXIS java2WSDL and WSDL2Java conversion, the implementation is slightly different.
Since, it seems that you have been able to deploy and run the project, your main concern was about generating the artifacts from the eclipse.
Here are a few suggestions, which will assist you...
You need to write a build file. Open it from the
ant view in eclipse .
goto menu window ---> show view --other --ANT
Run the tasks and the wsimport and wsgen will run and place the files in the respective folders.
I am pasting a sample build file, you can modify that according to your needs
My src directory name is fromjava.
This is how my deploy-targets.xml looks like
<project>
<property environment="env"/>
<property name="as.home" value="${env.AS_HOME}"/>
<property name="lib.home" value="${env.JAXWS_HOME}/lib"/>
<property name="lib.sample.home" value="${basedir}/../lib"/>
<property name="build.home" value="${basedir}/build"/>
<property name="build.war.home" value="${build.home}/war"/>
<property name="build.classes.home" value="${build.home}/classes"/>
<property name="domain" value="domain1"/>
<target name="deploy" depends="deploy-tomcat, deploy-appserver"/>
<target name="deploy-appserver" unless="tomcat">
<copy file="${build.war.home}/jaxws-${ant.project.name}.war"
todir="${as.home}/domains/${domain}/autodeploy"/>
</target>
<target name="deploy-tomcat" if="tomcat">
<copy file="${build.war.home}/jaxws-${ant.project.name}.war"
todir="${env.CATALINA_HOME}/webapps"/>
</target>
</project>
THis is the build.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="help" name="fromjava">
<import file="etc/deploy-targets.xml"/>
<path id="jaxws.classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<pathelement location="${lib.sample.home}/jaxwsSampleUtils.jar"/>
<fileset dir="${lib.home}">
<include name="*.jar"/>
<exclude name="j2ee.jar"/>
</fileset>
</path>
<taskdef name="apt" classname="com.sun.tools.ws.ant.Apt">
<classpath refid="jaxws.classpath"/>
</taskdef>
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath refid="jaxws.classpath"/>
</taskdef>
<target name="setup">
<mkdir dir="${build.home}"/>
<mkdir dir="${build.classes.home}"/>
<mkdir dir="${build.war.home}"/>
</target>
<target name="build-server-java" depends="setup">
<apt
fork="true"
debug="true"
verbose="${verbose}"
destdir="${build.classes.home}"
sourcedestdir="${build.classes.home}"
sourcepath="${basedir}/src">
<classpath>
<path refid="jaxws.classpath"/>
<pathelement location="${basedir}/src"/>
</classpath>
<option key="r" value="${build.home}"/>
<source dir="${basedir}/src">
<include name="**/server/*.java"/>
<include name="**/common/*.java"/>
</source>
</apt>
<!-- copy handlers descriptor file -->
<copy todir="${build.classes.home}">
<fileset dir="${basedir}/src">
<include name="**/server/**/*.xml"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${build.home}" includeEmptyDirs="true"/>
</target>
<target name="create-war">
<war warfile="${build.war.home}/jaxws-${ant.project.name}.war" webxml="etc/web.xml">
<webinf dir="${basedir}/etc" includes="sun-jaxws.xml"/>
<zipfileset
dir="${basedir}/etc"
includes="*.wsdl, *.xsd"
prefix="WEB-INF/wsdl"/>
<classes dir="${build.classes.home}"/>
</war>
</target>
<target name="generate-client" depends="setup">
<wsimport
debug="true"
verbose="${verbose}"
keep="true"
destdir="${build.classes.home}"
package="fromjava.client"
wsdl="http://localhost:8080/jaxws-fromjava/addnumbers?wsdl">
</wsimport>
</target>
<target name="client" depends="generate-client">
<javac
fork="true"
srcdir="${basedir}/src"
destdir="${build.classes.home}"
includes="**/client/**,**/common/**">
<classpath refid="jaxws.classpath"/>
</javac>
</target>
<target name="run">
<java fork="true" classname="fromjava.client.AddNumbersClient">
<classpath>
<path refid="jaxws.classpath"/>
<pathelement location="${build.classes.home}"/>
<pathelement location="${basedir}/etc"/>
</classpath>
</java>
</target>
<target name="help">
<echo message="server: Builds and deploy the service endpoint WAR"/>
<echo message="client: Builds the client"/>
<echo message="run: Runs the client"/>
<echo message="server-j2se: Builds and deploy the Endpoint API based service"/>
<echo message="server-j2se-stop: Stops Endpoint API based service"/>
</target>
<target name="server" depends="setup">
<antcall target="clean"/>
<antcall target="build-server-java"/>
<antcall target="create-war"/>
<antcall target="deploy"/>
</target>
<target name="server-j2se" depends="setup">
<antcall target="clean"/>
<antcall target="build-server-java"/>
<echo message="Starting endpoint... To stop: ant server-j2se-stop "/>
<java fork="true" classname="fromjava.server.AddWebservice">
<classpath>
<path refid="jaxws.classpath"/>
<pathelement location="${build.classes.home}"/>
</classpath>
</java>
</target>
<target name="server-j2se-stop" depends="setup">
<get src="http://localhost:9090/stop" dest="stop.status"/>
</target>
</project>
You also need to have the following files
This is the sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
<endpoint
name='fromjava'
implementation='fromjava.server.AddNumbersImpl'
url-pattern='/addnumbers'/>
</endpoints>
This is the web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <description>fromjava</description>
<display-name>fromjava</display-name>
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<
servlet>
<description>JAX-WS endpoint - fromjava</description>
<display-name>fromjava</display-name>
<servlet-name>fromjava</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>fromjava</servlet-name>
<url-pattern>/addnumbers</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>