Tag: cxf

如何使用Maven“shade”插件将Apache CXF应用程序打包到单片JAR中

我正在编写一个基于控制台的Java应用程序,旨在由cron以批处理方式运行。 批处理应用程序使用Apache CXF框架为JAX-WS调用SOAP Web服务。 为了简化部署并防止CLASSPATH问题,我想将应用程序(及其所有依赖项)捆绑到一个单一的JAR文件中…使用Maven的“shade”插件 。 当我从Eclipse工作区运行它时,我的应用程序工作正常。 但是,当我尝试执行着色的JAR文件时,我得到一个堆栈跟踪,如下所示: org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:404) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:258) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:146) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102) at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:115) at com.example.gui.domain.Session.getService(Session.java:145) at com.example.gui.domain.service.soap.AbstractServiceImpl.(AbstractServiceImpl.java:23) at com.example.gui.domain.service.soap.GetUserConsoleOrgsImpl.(GetUserConsoleOrgsImpl.java:14) at com.example.gui.domain.service.ServiceFactory.getGetUserConsoleOrgsService(ServiceFactory.java:443) at com.example.gui.domain.AccessManager.getOrgs(AccessManager.java:62) at com.example.gui.windows.ConsoleApplet.login (ConsoleApplet.java:1253) at com.example.gui.windows.ConsoleApplet.init(ConsoleApplet.java:1227) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.cxf.BusException: No binding factory […]

CXF 2.4.2:找不到命名空间http://schemas.xmlsoap.org/soap/http的管道启动器

我有一个从wsdl生成的服务客户端。 我正在尝试呼叫远程服务,我收到下面看到的导管启动器错误。 我尝试了很多解决方案但没有成功。 我找到了推荐使用http-jetty扩展的解决方案(旧post)。 我不相信这对我有意义,因为服务器没有在本地运行。 我还发现帮助我的最近配置是一个示例cxf.xml文件,其中包含: http://cxf.apache.org/transports/local http://cxf.apache.org/transports/http http://schemas.xmlsoap.org/soap/http http://schemas.xmlsoap.org/wsdl/soap/http 此配置提供有关如何配置传输工厂并将其绑定到http://schemas.xmlsoap.org/soap/http的指导 。 当我尝试使用HTTPTransportFactory时 ,我收到一个exception,它无法初始化(没有这样的方法错误)。 Caused by: org.apache.cxf.BusException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. at org.apache.cxf.transport.ConduitInitiatorManagerImpl.getConduitInitiator(ConduitInitiatorManagerImpl.java:112) at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:73) at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:61) at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:708) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:476) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:127) 预防措施:此时,我将停止尝试将我的CXF客户端升级到2.4.2,然后再回到最老的版本(2.2系列)。 这不太理想。 我想继续升级。 有关如何配置CXF 2.4.X的任何建议,以便我的客户端HTTP SOAP配置正确连接将非常适合。

如何修改出站CXF请求的原始XML消息?

我想修改一个传出的SOAP请求。 我想从信封的主体中删除2个xml节点。 我设法设置了一个Interceptor,并将生成的消息集的String值获取到端点。 但是,以下代码似乎不起作用,因为未按预期编辑传出消息。 有没有人有关于如何做到这一点的一些代码或想法? public class MyOutInterceptor extends AbstractSoapInterceptor { public MyOutInterceptor() { super(Phase.SEND); } public void handleMessage(SoapMessage message) throws Fault { // Get message content for dirty editing… StringWriter writer = new StringWriter(); CachedOutputStream cos = (CachedOutputStream)message.getContent(OutputStream.class); InputStream inputStream = cos.getInputStream(); IOUtils.copy(inputStream, writer, “UTF-8”); String content = writer.toString(); // remove the substrings from […]