简体   繁体   English

即使Apache CXF是依赖的,也使用JAX-WS存根

[英]Using JAX-WS stub even if Apache CXF is in dependency

WS client, it works when I call my WS when I create my stub, I get an SEIStub impl. WS客户端,当我创建存根时调用WS时,它可以工作,我得到一个SEIStub impl。

Then here is a new client for another WS in Apache CXF. 然后这是Apache CXF中另一个WS的新客户端。 We put the dependency in our pom, then bad things happen: When I call my first WS with my JAX-WS stub I get now a JaxWSClientProxy , Apache CXF seems to become the default implmentation. 我们将依赖关系放入pom中,然后发生坏事:当我用JAX-WS存根调用我的第一个WS时,现在得到一个JaxWSClientProxy ,Apache CXF似乎成为默认的实现。 and I cannot use my special header function that was done for WSBindingProvider instead of JaxWsClientProxy 而且我不能使用为WSBindingProvider完成的特殊标头函数,而不是JaxWsClientProxy

Generation of client with jaxws: 使用jaxws生成客户端:

            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>${jaxws.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <packageName>fr.xxxx.commons.client.stub.y</packageName>
                            <sourceDestDir>${ws.java.target}</sourceDestDir>
                            <extension>true</extension>
                            <wsdlDirectory>${project.parent.basedir}/src/main/wsdl/v2.1/</wsdlDirectory>
                            <wsdlFiles>
                                <wsdlFile>XXXXWebServices_v2.1.wsdl</wsdlFile>
                            </wsdlFiles>
                            <xnocompile>false</xnocompile>
                            <vmArgs>
                                <vmArg>-Djavax.xml.accessExternalDTD=all</vmArg>
                                <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
                            </vmArgs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

the JAX-WS instanciation where the error is (on the cast) 错误所在的JAX-WS实例(强制转换)

xStub = new XWebServicesV21(url, qnameXWebServices);

xGetPort.set(xStub.getAutogenerate());

generateHeader(aApplicationID, aUserId, (WSBindingProvider) xGetPort.get(), xUrl);

How to force JAXWS impl? 如何强制JAXWS impl? I use JDK8 and Apache CXF 2.3.11 . 我使用JDK8和Apache CXF 2.3.11。

Sun's jaxws use com.sun.xml.ws.developer.WSBindingProvider , but CXF does not use it. Sun的jaxws使用com.sun.xml.ws.developer.WSBindingProvider ,但是CXF不使用它。 org.apache.cxf.jaxws.JaxWsClientProxy implements javax.xml.ws.BindingProvider org.apache.cxf.jaxws.JaxWsClientProxy实现javax.xml.ws.BindingProvider

Therefore you can not cast xGetPort.get() to WSBindingProvider . 因此,您不能将xGetPort.get() WSBindingProviderWSBindingProvider In order to add soap headers with CXF in a similar way that WSBindingProvider.setOutboundHeaders check documentation or use CXF WS-Security support to generate the standard authentication headers for SOAP messages 为了以类似于WSBindingProvider.setOutboundHeaders检查文档的方式向CXF添加soap标头,或使用CXF WS-Security支持来生成SOAP消息的标准身份验证标头。

If you want to use Sun's jaxws, make sure the jars are in the classpath before, or remove cxfjaxws dependencies. 如果要使用Sun的jaxws,请确保jar之前位于类路径中,或者删除cxfjaxws依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM