简体   繁体   中英

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM