Lazaruss
Lazaruss

Reputation: 1237

How can i generate soap service from wsdl in spring boot?

I am trying to create a soap service in soap1.2. So I am using spring boot and JAX-WS.

I have tried using these tutorials :

https://www.baeldung.com/jax-ws https://glenmazza.net/blog/entry/switch-soap11-to-soap12 https://examples.javacodegeeks.com/enterprise-java/jws/jax-ws-annotations-example/

However, nothing i tried works. My manually-created service doesn't work.

Is there a way to generate the service automatically from WSDL, along with the request and response classes ?

Upvotes: 1

Views: 5712

Answers (1)

Lazaruss
Lazaruss

Reputation: 1237

After a long google search, i have found a maven plugin that does just that :

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>3.2.7</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>${project.build.directory}/generated-code/mysoapservice</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>${basedir}/src/main/resources/wsdl/my_soap_service.wsdl</wsdl>
                        <extraargs>
                            <extraarg>-all</extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

This worked for me. Maybe it will fork for someone else too.

Upvotes: 2

Related Questions