Tag Archives: webservice

WebService build by WSDL with Ant and wsimport

Just create a progect and ant build file with:

<?xml version="1.0" encoding="utf-8" ?>
<project name="wsNameClent" basedir=".">

<property name="wsdl" value="http://localhost:8080/wsSome?wsdl"/>
<target name="wsimport">
 	<exec executable="wsimport" >
 		<arg value="-verbose"/>
 		<arg value="-keep"/>
 		<arg value="-d"/>
 		<arg value="bin"/>
 		<arg value="-s"/> 
 		<arg value="src"/>
 		<arg value="${wsdl}"/>
 	</exec>
</target>

</project>

If you’ve to provide authorized access add to args:

	<arg value="-Xauthfile"/>
	<arg value="src/resources/auth"/>

Where src/resources/auth is like:


http://userName:userPass@key-provider.com/keyws?wsdl

No one code typing!

To test your svc use like this:

TwitService svc = new TwitService();
GetAllTwitsResponse resp = svc.getTwitSoap11().getAllTwits(new GetAllTwitsRequest());
for (Twit_Type tw : resp.getTwit())
{
	System.out.println(tw.getNick() + " - " + tw.getMessage());
}

Also, good java webservices tutorial http://www.mkyong.com/tutorials/jax-ws-tutorials/