我们面临使用apache cxf-codegen-plugin从wsdl生成正确的SOAP请求的问题。被客户触发的请求缺少SOAP信封和SOAP主体标签。是我们必须以编程方式执行的操作,还是可以在Extraargs插件中配置的操作? 重现步骤 1.在pom中包含cxf-codegen-plugin maven插件版本3.0.3 2.在生成源期间,将生成源。
当请求被触发时,它看起来像这样
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CalculateSomething xmlns="http://something/0.3.1/" xmlns:ns2="http://something/0.1/" xmlns:ns3="http://something"></CalculateSomething>
而不是当我们通过POSTMAN尝试时(成功了),应该生成的请求是
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns3:CalculateSomething xmlns:ns4="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns3="http://something" xmlns:ns2="http://something" xmlns="http://something/0.1/">
<ns3:request>...
</ns3:CalculateSomething>
</S:Body>
</S:Envelope>
基本上,我们似乎无法通过cxf codegen插件正确生成SOAP信封,或者我们没有正确配置它。 绒球里有这个。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/something.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-sources/jaxb</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>