我正在使用maven和java11。我正在从wsdl生成类。我希望看到这个
@WebMethod(operationName = "CheckDataBox")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebResult(name = "CheckDataBoxResponse", targetNamespace = "http://isds.czechpoint.cz/v20", partName = "parameter")
public TCheckDBOutput checkDataBox(
@WebParam(partName = "parameter", name = "CheckDataBox", targetNamespace = "http://isds.czechpoint.cz/v20")
TIdDbInput parameter
);
但它产生了这个
@WebMethod(operationName = "CheckDataBox")
@RequestWrapper(localName = "CheckDataBox", targetNamespace = "http://isds.czechpoint.cz/v20", className = "cz.czechpoint.isds.v20.db.TIdDbInput")
@ResponseWrapper(localName = "CheckDataBoxResponse", targetNamespace = "http://isds.czechpoint.cz/v20", className = "cz.czechpoint.isds.v20.db.TCheckDBOutput")
public void checkDataBox(
@WebParam(name = "dbID", targetNamespace = "http://isds.czechpoint.cz/v20")
String dbID,
@WebParam(name = "dbApproved", targetNamespace = "http://isds.czechpoint.cz/v20")
Boolean dbApproved,
@WebParam(name = "dbExternRefNumber", targetNamespace = "http://isds.czechpoint.cz/v20")
String dbExternRefNumber,
@WebParam(name = "dbState", targetNamespace = "http://isds.czechpoint.cz/v20", mode = WebParam.Mode.OUT)
Holder<Integer> dbState,
@WebParam(name = "dbStatus", targetNamespace = "http://isds.czechpoint.cz/v20", mode = WebParam.Mode.OUT)
Holder<TDbReqStatus> dbStatus);
我正在使用
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
...
<build>
...
<plugins>
...
<plugin>
<!--groupId>com.sun.xml.ws</groupId-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<!--version>2.3.2</version-->
<version>2.6</version>
<executions>
<execution>
<id>db</id>
<phase>process-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<keep>true</keep>
<wsdlFiles>
<wsdlFile>${basedir}/src/main/resources/wsdl/db_search.wsdl</wsdlFile>
<wsdlFile>${basedir}/src/main/resources/wsdl/db_access.wsdl</wsdlFile>
</wsdlFiles>
<packageName>cz.czechpoint.isds.v20.db</packageName>
<sourceDestDir>${project.build.directory}/generated-sources/wsdl/db</sourceDestDir>
</configuration>
</execution>
<execution>
<id>dm</id>
<phase>process-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<keep>true</keep>
<wsdlFiles>
<wsdlFile>${basedir}/src/main/resources/wsdl/dm_info.wsdl</wsdlFile>
<wsdlFile>${basedir}/src/main/resources/wsdl/dm_operations.wsdl</wsdlFile>
</wsdlFiles>
<packageName>cz.czechpoint.isds.v20.dm</packageName>
<sourceDestDir>${project.build.directory}/generated-sources/wsdl/db</sourceDestDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
wsdl文件可以在这里找到https://github.com/dfridrich/czechdatabox/tree/master/resources (不同的人的观点不同,但我使用的是相同的wsdl。)
为什么不生成一个参数,我需要做些什么来实现它?
1条答案
按热度按时间o8x7eapl1#
wsimport
决定如何使用enableWrapperStyle
配置。您可以遵循两种方法来避免使用更多参数而不是单个参数。方案1。带绑定文件
您不需要更新wsdl文件。告诉警察
wsimport
如何处理方法参数。创建一个名为
binding.xml
进入src/main/resources/wsdl
.绑定.xml
更新您的
pom.xml
用下面的脚本。还有一个额外的步骤是bindingFiles
元素。pom.xml文件
引用:wsimport:禁用 Package 器样式
方案2。更改wsdl文件
在每个wsdl文件中插入下面的xml定义。添加此定义后,方法的参数将仅是一个输入参数,而不是所有参数。
示例:db\u search.wsdl(粘贴到所有wsdl文件)