简体   繁体   中英

SOAP service in spring boot

I'm confused about the way I'm compelled to create a SOAP service in spring boot. I wrote many SOAP services in Java in the past, simply writing down the java code and not a line of XML. A very easy and error less approach. All the tutorial I read for Spring Boot has the need to write an XSD document, form which maven will read and build the needed classes.

Is there a way, supported by Spring Boot, to bypass the XSD file and write directly the needed java classed instead?

Just to give you some example of what I read, here are some links to the tutorials I'm referring to:

I believe that writing the XML code to generate the Java one is very error prone and a really difficult to maintain code, when you're developing big services or services with a lot of objects. All works fine if you have a small project, that is not my case.

What I did was to write the classes and then generate the xsd file using schemagen .

This is the configuration in maven pom I added:

 <plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>jaxb2-maven-plugin</artifactId>
     <version>2.4</version>
     <executions>
         <execution>
             <id>schemagen</id>
             <goals>
                 <goal>schemagen</goal>
             </goals>
         </execution>
     </executions>

     <configuration>
            <outputDirectory>${basedir}/src/main/resources/xsds/</outputDirectory>
            <transformSchemas>
                <transformSchema>
                    <uri>http://test/test-ws/MyTestSchema</uri>
                    <toPrefix>test</toPrefix>                            
                    <toFile>test.xsd</toFile>
                </transformSchema>
             </transformSchemas>
             <sources>
                 <source>${basedir}/src/main/java/my/classes/</source>
             </sources>
             <verbose>true</verbose>
     </configuration>
 </plugin>

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