Home

Awesome

Dropwizard-JAXWS

Dropwizard-JAXWS is a Dropwizard Bundle that enables building SOAP web services and clients using JAX-WS API with Dropwizard.

Features

Using

To use dropwizard-jaxws in your project, add the following dependency to your pom.xml:

    <dependency>
        <groupId>com.github.roskart.dropwizard-jaxws</groupId>
        <artifactId>dropwizard-jaxws</artifactId>
        <version>1.2.3</version>
    </dependency>

Hello World

SOAP service:

    @Metered
    @WebService
    public HelloWorldSOAP {
        @WebMethod
        public String sayHello() {
            return "Hello world!";
        }
    }

Dropwizard application:

    public class MyApplication extends Application<MyApplicationConfiguration> {

        private JAXWSBundle jaxWsBundle = new JAXWSBundle();

        @Override
        public void initialize(Bootstrap<MyApplicationConfiguration> bootstrap) {
            bootstrap.addBundle(jaxWsBundle);
        }

        @Override
        public void run(MyApplicationConfiguration configuration, Environment environment) throws Exception {
            jaxWsBundle.publishEndpoint(
                new EndpointBuilder("/hello", new HelloWorldSOAP()));
        }

        public static void main(String[] args) throws Exception {
            new MyApplication().run(args);
        }
    }

Client

Using HelloWorldSOAP web service client:

    HelloWorldSOAP helloWorld = jaxWsBundle.getClient(
        new ClientBuilder(HelloWorldSOAP.class, "http://server/path"));
    System.out.println(helloWorld.sayHello());

Examples

Module dropwizard-jaxws-example contains Dropwizard application (JaxWsExampleApplication) with the following SOAP web services and RESTful resources:

Running the examples:

After cloning the repository, go to the dropwizard-jaxws root folder and run:

    mvn package

To run the example service:

    java -jar dropwizard-jaxws-example\target\dropwizard-jaxws-example-1.2.3.jar server dropwizard-jaxws-example\config.yaml

Notes

Building FAT jar

When using maven-shade-plugin for building fat jar, you must add the following transformer element to plugin configuration:

    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
        <resource>META-INF/cxf/bus-extensions.txt</resource>
    </transformer>

For example on building fat jar, see dropwizard-jaxws-example/pom.xml.

When using Gradle and a recent version of shadowJar use the following snippet:

shadowJar {
    // ...
    append('META-INF/cxf/bus-extensions.txt')
}

License

Apache Software License 2.0, see LICENSE.

Changelog

v1.2.3

v1.2.2

v1.2.1

v1.2.0

v1.1.0

v1.0.5

v1.0.4

v1.0.3

v1.0.2

v1.0.1

v1.0.0

v0.10.2

v0.10.1

v0.10.0

v0.9.0

v0.8.0

v0.7.0

v0.6.0

v0.5.0

v0.4.0

v0.3.0

v0.2.0

v0.1.0