[英]SOAP service in spring boot
我对在春季启动时不得不创建SOAP服务的方式感到困惑。 过去,我用Java编写了许多SOAP服务,只是写下了Java代码,而不是一行XML。 一种非常简单且无错误的方法。 我为Spring Boot阅读的所有教程都需要编写XSD文档,Maven将以此形式阅读并构建所需的类。
Spring Boot支持一种方法来绕过XSD文件并直接编写所需的Java类吗?
只是为了给您一些我所读内容的示例,这里有一些指向我所指的教程的链接:
我相信,当您开发大型服务或带有许多对象的服务时,编写XML代码来生成Java代码非常容易出错,并且很难维护代码。 如果您有一个小型项目,那么一切正常,这不是我的情况。
我要做的是编写类,然后使用schemagen生成xsd文件。
这是我添加的maven pom中的配置:
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.