BowerStudios.com

  • My Lab
  • Family
  • Friends
  • Professional
  • About
Home

Groovy & Gradle Scripts to Generate Java classes for a wsdl of a php5 app using axis 1.4

daniel —Wed, 02/09/2011 - 11:30am

  • Groovy

UPDATE at bowerstudios

Had to consume the SOAP service of a php5 app, and it was a bear.

Ended up using Axis (The First Version) since the wsdl was rpc-encoded, and I was unable to get the Groovy-WS plugin working with it.

Here is a nice self contained groovy script to generate java classes for a wsdl
@Grab(group='axis', module='axis', version='1.4')
import org.apache.axis.wsdl.WSDL2Java
class Generator {
static def generate(){
WSDL2Java.main("http://localhost/myservice.wsdl")
}
}
Generator.generate()

Or, add a task to Gradle:
In build.gradle
Add to Configurations:
configurations {
compile
runtime
axisGenAntTask
}

Then add this dependency:
axisGenAntTask 'axis:axis-ant:1.4', 'axis:axis:1.4'

Finally, add the Task:
task genWsdlClasses() << {
ant.echo(message:'Generating Classes for use with WSDL')
ant.taskdef(
name: 'genClassesFromWSDL',
classname: 'org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask',
classpath: configurations.axisGenAntTask.asPath
)
def wsdlLocation = 'http://localhost/myservice.wsdl'
ant.genClassesFromWSDL(
url: wsdlLocation,
output: 'src/main/java'
)
}

  • Log in to post comments

Navigation

  • Search
  • Recent content
  • Contact Me
  • Mail
  • Pass Hasher
  • Bower Studios Admin

Quotes

daniel —Fri, 08/25/2006 - 10:16pm

I know you believe you understand what you think I said, but I'm not sure you realize that what you heard is not what I meant.

—

Richard Nixon

  • Log in to post comments
  • daniel's quotes

Popular content

Last viewed:

  • Useful Backup Tools on *nix
  • Never underestimate the power of pretty.
  • Determine whether your java install has limited key strength due to export restrictions
  • Collectd on Ubuntu (Monitoring)
  • Postgresql - Search all tables for a column name

Copyright 2021 Daniel Bower
  • My Lab
  • Family
  • Friends
  • Professional
  • About