您如何使用 Enunciate 生成 SOAP 1.2 WSDL?

How do you generate a SOAP 1.2 WSDL with Enunciate?

我正在开发一个用 Java 编写的 Web 服务,并使用 Enunciate 生成 Web 服务客户端。

该项目在 SOAP 1.1 上运行良好,但是当我尝试升级到 SOAP 1.2 时,我 运行 遇到了一些困难。 Enunciate 生成的 WSDL 仍然是 SOAP 1.1,这就是打包到客户端中的内容。

按照此处的建议:https://jax-ws.java.net/2.1.5/docs/soap12.html 我试图注释该服务以指示 SOAP 1.2,但无济于事:

@WebService(endpointInterface = "com.example.MyService", serviceName="myService")
@Service("myService")
@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
public class  MyServiceImpl implements MyService {

Maven 插件配置如下所示:

        <plugin>
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-plugin</artifactId>
            <version>1.29</version>
            <executions>
                <execution>
                    <id>docs</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>docs</goal>
                    </goals>
                    <configuration>
                        <configFile>enunciate.xml</configFile>
                    </configuration>
                </execution>
                <execution>
                    <id>install</id>
                    <goals>
                        <goal>install-artifact</goal>
                        <goal>deploy-artifact</goal>
                    </goals>
                    <configuration>
                        <enunciateArtifactId>java.client.library</enunciateArtifactId>
                        <groupId>com.example</groupId>
                        <artifactId>myServiceClient</artifactId>
                        <version>${client.version}</version>
                    </configuration>
                </execution>
            </executions>
        </plugin>   

我在 https://github.com/stoicflame/enunciate/wiki/Module-XML 的阐述 XML 文档中也没有看到任何有用的信息。

如何从 Enunciate 获取 SOAP 1.2 生成的 WSDL?

更新

我进行了更多的挖掘,发现 WSDL 是通过 wsdl.fmt 生成的,并且它具有 SOAP 1.1 名称空间和此类硬编码,并且它不考虑注释或调用 CXF。

显然,我可以调用 CXF 来生成 SOAP 1.2 WSDL,并且可以使用 Enunciate 通过 wsdl 元素上的 useFile 属性重新使用它。有没有办法将这个 WSDL 文件包含在 Enunciate 客户端 jar 中?没有它,代理生成似乎会失败。

我最终发现,Enunciate 既不支持 SOAP 1.2 WSDL,也不支持我试图回退的混合和匹配方法。计划添加到更高版本中:

https://github.com/stoicflame/enunciate/issues/95#issuecomment-123498784