Axis 2
Generating the Web Service in Eclipse
With WTP 2 installed, right click on org.plutext.server.WebService, then Web Services > Create Web Service.
We want a bottom up Java bean Web Service. Click next.
The next page should be entitled "Axis2 Web Service Java Bean Configuration". If it isn't, your Eclipse may be using Axis1, not 2. See this post http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.webtools/ - ADD NEWSGROUP LINK
Allow it to generate default services.xml file.
Move the result from WEB-INF/services to WEB-INF/axis2-repository/services (the location specified in the relevant init-param in web.xml), and you're done.
Microsoft client interop
The client code generated by Visual Studio has a few issues with Axis 2's WSDL (it was fine with the WSDL generated by Axis 1).
<xs:element minOccurs="0" name="firstSequenceNumber" type="xs:long"/>
This new form of WSDL causes source code auto-generated by Microsoft.VSDesigner, Version 2.0.50727.312 using System.Web.Services, 2.0.50727.312 to include an unwanted third parameter named firstSequenceNumberSpecified:
public string[] getTransforms(
[System.Xml.Serialization.XmlElementAttribute?(IsNullable?=true)] string docID,
long firstSequenceNumber,
[System.Xml.Serialization.XmlIgnoreAttribute?()] bool firstSequenceNumberSpecified)
Now in Axis 2's WSDL, everything has minOccurs="0". That in itself is not enough to trigger the errant behaviour in the Windows client.
The errant behaviour is triggered by the type xs:long, but not for example, by xs:string or xs:anyType.
I see org.apache.axis2.dataretrieval.WSDLDataLocator calls org.apache.axis2.description.AxisService?2WSDL11 which in turn uses org.apache.ws.commons.schema.XmlSchema? to serialise itself.
But a quick look at http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java?view=markup suggests there is no easy way to tell Axis 2 not to generate minOccurs="0"?
See http://issues.apache.org/jira/browse/AXIS2-3300
For the moment, I'm manually deleting minOccurs="0", and feeding the resulting WSDL file to Visual Studio to generate the client. Doing it this way, it seems you also have to change the URL in the WSDL from localhost to the URL of your server.
Minimal Axis 2 deployment
A contradiction in terms! .. It was by no means obvious what jars are required for a minimal Axis 2 deployment.
To work it out:
- I checked Axis 2 out from subversion, and set up Eclipse projects for axis2-kernel, axis2-jaxws, axis2-jaxws-api, then added these as J2EE Module Dependencies to plutext-server (which causes axis2-kernel.jar and axis2-jaxws.jar to appear in WEB-INF/lib).
- then a cycle of starting tomcat, looking to see what class was missing, adding the relevant dependency to the pom (or changing axis2.xml), and restarting tomcat.
- finally, add entries to the pom for axis2-kernel, axis2-jaxws, axis2-jaxws-api, and remove those J2EE Module Dependencies from plutext-server
See DependencyTree for the results.
