Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools incubator » JAX-WS(JAX-WS wiki for Ecilpse Galileo)
JAX-WS [message #519155] Sun, 07 March 2010 13:38 Go to next message
Sam  is currently offline Sam Friend
Messages: 7
Registered: March 2010
Junior Member
Hi,

I dont' know what version of Eclipse I got. Only know its name is Galileo when it started up from the screen.
Platform: Windows Vista,
Java: 5+

I have searched for JAX-WS tutorial or wiki and also have searched help.eclipse.org/ still not able to find any step-by-step example about how to build a jax-ws service.

I found some "tutorial" use plug-ins to build jax-ws , but is this necessary? because I known jax-ws is part of java 5 or 6.
Should I really need to install any "plug-ins" in this Eclipse version (Galileo) before start building jax-ws?

Your suggestion and reference links are much appreciated.

Thanks
Sam Confused
Re: JAX-WS [message #519175 is a reply to message #519155] Sun, 07 March 2010 18:51 Go to previous messageGo to next message
Kurt  is currently offline Kurt Friend
Messages: 22
Registered: February 2010
Junior Member
Sam,

Some things have changed since the last time a step-by-step tutorial was created, but this will give you lots of clues:

http://repo.fusesource.com/videos/service-creation/Java2WSCl ientServer.wmv

The JAX-WS plug-ins I needed didn't install with Galileo by default. Go to Help->Install New Software and look around for "CXF Web Services (Incubation)." Check the box and install it.

I believe you can still use Axis2 with good results but I'm using Apache CXF. You'll need one of them available on disk and pointed to from the Web Services preferences within Eclipse to get going.
Re: JAX-WS [message #519194 is a reply to message #519155] Sun, 07 March 2010 22:53 Go to previous messageGo to next message
Shane Clarke is currently offline Shane ClarkeFriend
Messages: 67
Registered: July 2009
Member
Hi Sam,

The JAX-WS Tools plug-ins provide tooling for working with and validating JAX-WS annotations along with using the Apache CXF runtime to create JAX-WS Web services.

JAX-WS is part of the Java 6 JDK but there is no tooling that will allow you to use it with the WTP Web Services wizards.

You can install the JAX-WS Tools using the http://download.eclipse.org/webtools/milestones/ update site.

That install also includes user documentation and cheat sheets to help you get started using the tools to create JAX-WS Web services.

You can access the documentation once installed by going to the Help > Help Contents > JAX-WS Tools User Guide.

You can also access the cheatsheets by selecting Help > Cheat Sheets > JAX-WS Development.
Re: JAX-WS [message #519208 is a reply to message #519175] Mon, 08 March 2010 02:37 Go to previous messageGo to next message
Sam  is currently offline Sam Friend
Messages: 7
Registered: March 2010
Junior Member
Thank you for the explanation, it does clear some of my puzzle.

Is there any way that I dont' need to install CXF package but compile/build the JAX-WS service in Eclipse Galileo?

In my work place, I imported a JAX-WS project which was created by other developers . The package included some xml included a build.xml file. I can build this WS project with build.xml (double click on its "deploy" command in the Eclipse Ant panel) without install any CXF package. And some developer said it doesn't need to install any jax-ws package before building this jax-ws project, because it is a build-in features/api from JDK 5/6.

But then why need CXF in eclipse if I can build a jax-ws without it? since it is part of jdk api.

here is the build.xml file this project use, do I need to create this build.xml by hand?

Quote:


<?xml version="1.0" encoding="UTF-8"?>

<project basedir="." default="help" name="portalWS">

<import file="etc/deploy-targets.xml"/>

<path id="jaxws.classpath">
<pathelement location="${basedir}/../portal/lib/global/portal-service.jar "/>
<pathelement location="${basedir}/../portal/lib/global/portal-kernel.jar "/>
<pathelement location="${java.home}/../lib/tools.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>

<path id="tests.path">
<pathelement location="${testDir}/../build/classes"/>
<pathelement location="${test_jars}/junit.jar"/>
<pathelement location="${basedir}/../portal/lib/global/portal-service.jar "/>
<pathelement location="${basedir}/../portal/lib/global/portal-kernel.jar "/>
<pathelement location=" ${basedir}/../portal/ext-lib/development/mockito-all-1.8.2.j ar "/>
</path>

<!-- JUNIT TESTS -->
<target name="test" depends="build-server-java, compile-test">
<echo>Ultranet WS Tests</echo>
<delete dir="${junitOut}"/>
<mkdir dir="${junitOut}"/>
<mkdir dir="./reports"/>

<junit printsummary="yes" haltonfailure="no" maxmemory="1024m">
<classpath>
<path refid="tests.path"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="true" todir="${testDir}/junitOut">
<fileset dir="${testDir}"
includes="**/*Test.java"
/>
</batchtest>
</junit>
<echo>Report on WS Tests</echo>
<junitreport todir="./reports">
<fileset dir="./test/junitOut">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./reports"/>
</junitreport>
</target>

<target name="compile-test">
<javac
classpathref="tests.path"

debug="true"
deprecation="true"
destdir="${build.classes.home}"
nowarn="${javac.nowarn}"
srcdir="test" />
</target>

<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="false"
destdir="${build.classes.home}"
sourcedestdir="${build.classes.home}"
sourcepath="${basedir}/src" >

<option key="r" value="${build.home}"/>
<classpath>
<path refid="jaxws.classpath"/>
<pathelement location="${basedir}/src"/>
</classpath>
<source dir="${basedir}/src">
<include name="**/server/*.java"/>
<include name="**/ultranetWS/*.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}/${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/portalWS/UltranetWS?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=" au.com.csg.ultranet.ultranetWS.UltranetWSImpl.UltranetWSClie nt ">
<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="deployLocal: Builds and deploy the Endpoint API based service"/>
<echo message="deployLocal-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="deployLocal" depends="setup">
<antcall target="clean"/>
<antcall target="build-server-java"/>
<echo message="Starting endpoint... To stop: ant deployLocal-stop "/>
<java fork="true" classname="au.com.ip6.myWS.RunMyWS">
<classpath>
<path refid="jaxws.classpath"/>
<pathelement location="${build.classes.home}"/>
</classpath>
</java>
</target>

<target name="deployLocal-stop" depends="setup">
<get src="http://localhost:9090/stop" dest="stop.status"/>
</target>

</project>


<!-- refer to Sun Metro samples: fromJava -->





Greatly thanks
Sam
Re: JAX-WS [message #519294 is a reply to message #519208] Mon, 08 March 2010 12:40 Go to previous messageGo to next message
Shane Clarke is currently offline Shane ClarkeFriend
Messages: 67
Registered: July 2009
Member
Hi Sam,

From what you've described no you don't need to install the JAX-WS Tools.

You can continue to compile and build your projects with JDK 6 and use the ANT files to deploy.

The CXF plug-ins in the tools provide preferences and integrations with the WTP Web Services wizards for using the Apache CXF runtime.

With this you can setup the CXF runtime, it's default options and you can use the WTP Web services wizards to develop, deploy, test and publish your JAX-WS Web services and to create clients for existing services.

The JAX-WS Tools also includes tooling that it is not bound to any JAX-WS runtime and that may be of use to you.

This includes validation of the JAX-WS annotations in the Java Editor along with quick fixes for many errors. There is also content assist available for some of the JAX-WS annotation attribute values.

Re: JAX-WS [message #519504 is a reply to message #519294] Tue, 09 March 2010 04:21 Go to previous messageGo to next message
Sam  is currently offline Sam Friend
Messages: 7
Registered: March 2010
Junior Member
Hi, thanks for the suggestion.
I have written some *.java file, including the one used to generate the wsdl file,
eg.

Quote:

@WebService
public class MyWSImpl {

public MyWSResult addUserToRegularRole(
@WebParam(name="userId") String userName,
@WebParam(name="roleId") String roleName
) {
...
}
}




If I want to use SOAPUI to test it, I need to import a wsdl file that generated by the MyWSImpl class (correct me if I am wrong), now how to execute this MyWSImpl class in order to generate the wsdl file?


Thanks
Sam
Re: JAX-WS [message #519606 is a reply to message #519504] Tue, 09 March 2010 12:59 Go to previous messageGo to next message
Shane Clarke is currently offline Shane ClarkeFriend
Messages: 67
Registered: July 2009
Member
For JDK 6 you can use the wsgen command line tool that ships with the JDK.

running something like:

wsgen -cp . -wsdl MyWSImpl

will generate a wsdl file for you.

See here for more information:
https://jax-ws.dev.java.net/nonav/2.1.1/docs/wsgen.html

or you can set up an ANT task:
https://jax-ws.dev.java.net/nonav/2.1.1/docs/wsgenant.html
Re: JAX-WS [message #523077 is a reply to message #519504] Thu, 25 March 2010 00:06 Go to previous message
chris wong is currently offline chris wongFriend
Messages: 4
Registered: March 2010
Junior Member
Sam,
it was pointed out to me in another forum that sun wrote a plugin for both metro and jersey (JAX-WS)

See https://metroplugineclipse.dev.java.net/

I wonder if we can lobby to have this built into Eclipse WTP by default?

Previous Topic:On-going nightmare -> ClassNotFoundException: org.apache.cxf.transport.servlet.CXFServlet
Next Topic:JAX-WS
Goto Forum:
  


Current Time: Wed Dec 11 19:10:01 GMT 2024

Powered by FUDForum. Page generated in 0.04397 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top