I found that the JAX-WS RI has a Maven2 plugin but not the JAX-RPC RI. I did a lot of googling, and posted messages in a few mailing lists. Surprisingly there is almost nobody using JAX-RPC on Maven2 projects because there are barely any examples online and nobody could answer my question. I'm surprised because there are a lot of legacy systems out there that developers need to integrate with, so I can't be the only one still needing JAX-RPC support. Some people suggested that I update the web service to modern RPC literal to make client-side development easier with JAX-WS, but that is not an option. Others suggested that I use Maven's antrun plugin to call out to an ant build script that does JAX-RPC work. Finally I found an all Maven solution that works for me:
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<configuration>
<packageSpace>com.mycompany.service.client</packageSpace>
<sourceDirectory>src/main/resources/META-INF/wsdl</sourceDirectory>
<outputDirectory>target/generated-sources/wsdl2java</outputDirectory>
</configuration>
</plugin>
private MyServiceSEI getMyServicePort() throws ServiceException {
MyServiceLocator locator = new MyServiceLocator();
MyServiceSEI port;
Stub stub;
port = locator.getMyServiceSEIPort();
// OPTIONALLY configure URL and HTTP BASIC authentication
stub = (Stub) port;
stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://hostname/ContextRoot/ServicePort");
stub._setProperty(Stub.USERNAME_PROPERTY, "user");
stub._setProperty(Stub.PASSWORD_PROPERTY, "secret");
return port;
}
It works, but I think the client stubs are dependent on the Axis 1 runtime instead of using the GlassFish provided JAX-RPC runtime through the standardized JAX-RPC APIs. I've wasted enough time on this so I moved on. If you know a better way to do this, please let me know.

4 comments:
dependencies:
javax.xml:jaxrpc-api:1.1
com.sun.xml.rpc:1.1.3_01 (exclusion: javax.activation:activation)
com.sun.xml.rpc:jaxrpc-spi:1.1.3_01
repositories:http://download.java.net/maven/2/ (layout: default) and http://download.java.net/maven/1 (layout: legacy)
Then use the maven-antrun-plugin to run wscompile
<taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile"><classpath refid="maven.compile.classpath" /><taskdef/>
Wow, thank you!
thanks for the post.
i have similar needs. i want to convert existing build process from Ant to Maven.
i was shoked to know there is no plugin for jaxrpc to do wscompile and wsdeploy.
i had to write my Ant script into pom.xml and run it with maven-antrun-plugin. it worked well as single maven module. but once i used a parent\aggregator projects, the wscompile fails. its a real hell.
Great Post, Helped me get past the error I was getting.
Post a Comment