问题标签 [cxf-client]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
38 浏览

jakarta-ee - 需要为 CXF 中的传出 SOAP 响应注入一些值

我正在使用 CXF,我的问题有两个方面:

1)如何为传出响应生成自定义soap标头?

2)如何从实现函数中注入一些价值?

0 投票
1 回答
128 浏览

rest - bytearray 的 readentity 没有消息正文阅读器

bytearray 的 readentity 没有消息正文阅读器

这发生在从 cxf 客户端读取字节响应时。

cxf 版本是 2.7.6

请建议我如何在其中添加消息正文阅读器。

你的建议很有价值..

0 投票
0 回答
1353 浏览

logging - Apache CXF 不使用 log4j2 记录 SOAP 消息

我将 Apache CXF 3.1 用于 SOAP 客户端。我打算使用 log4j2 将所有传入和传出的 SOAP 消息记录到日志文件中。这是我目前的设置:

SOAP 客户端使用JaxWsProxyFactoryBean.

org.apache.cxf.Logger在目录中放置了一个文件src/META-INF/cxf,内容为org.apache.cxf.common.logging.Log4jLogger

cxf.xml:

log4j2.xml:

但是我在文件中看不到任何 CXF 日志消息。我在这里想念什么?

0 投票
0 回答
793 浏览

apache - 获取 java.io.EOFException:使用 CXF 从 Weblogic 调用 Rest API 时响应不包含数据

当我使用 JAXRS 调用休息 API 时,我收到 EOFException。

当我作为独立的 Java 应用程序运行时。它工作正常,我得到了回应。但是当我在 Weblogic 10.3 中执行时,我收到了 EOFException。

在代码片段下方。

当我在 Weblogic 中执行相同的操作时。我收到以下异常。

任何指针。

谢谢。

0 投票
1 回答
773 浏览

chunked-encoding - 无论 AllowChunking 设置如何,CXF JAX-RS 客户端始终以分块模式发送空 PUT 请求

我们使用 CXF JAX-RS 客户端向我方执行 PUT 请求。请求正文为空。一个简单的请求调用会导致服务器响应代码为 411。

我们党的 REST-server 需要设置 Content-Length HTTP-header。

我们根据有关分块的说明关闭了分块,但这并没有解决问题。REST 服务器仍然回答 411 错误。

这是来自 cxf.xml 文件的管道配置

日志中的行确认我们的请求的执行绑定到我们的管道配置:

显式添加 Content-Length 标头也无济于事。

CXF 客户端的日志条目确认了标头设置,但是当我们嗅探数据包时,我们惊讶地发现标头设置已被 CXF 客户端完全忽略。未发送 Content-Length 标头。

这是日志。存在 Content-Length 标头:

这是数据包嗅探器的输出。Content-Length 标头不存在:

有谁知道实际上如何禁用分块?

这是我们的代码:

版本:

  • 操作系统:Windows 7 企业版 SP1
  • 拱门:x86_64
  • 爪哇:1.7.0_80
  • CXF:3.1.8
0 投票
0 回答
69 浏览

java - 有没有办法访问以前的 CXF 消息?

我知道我可以通过以下方式访问当前消息:

但是当 cxf 创建新消息时,我丢失了之前交换的两个标头。有没有办法以某种方式访问​​旧消息,或将标头从旧消息传递到新消息(所以我不会丢失所需的数据)?

0 投票
1 回答
3042 浏览

java - CXF生成的客户端HandlerTubeFactory没有实现TubeFactory

我使用 wsdl2java 生成客户端。当我运行这个客户端时,我得到

我的 pom.xml 包含以下相关依赖项(没有显示太多)

这是我的客户代码:

这是生成的服务代码的顶部:

谢谢佩德罗布。我只能通过显式覆盖 ServiceDelegate 来让它工作,将它添加到我的代码中,在一个大的 try catch 块中。

0 投票
2 回答
3131 浏览

java - Spring - Retry request if service returns 409 HTTP Code

I have an Spring + CXF application which consumes a Transmission API: Transmission RPC running in another server.

According to Transmission docs, you need to send a token which is generated on the first request. The server then responds with a 409 http code along with a header containing the token. This token should be sent on all subsequent calls:

2.3.1. CSRF Protection Most Transmission RPC servers require a X-Transmission-Session-Id header to be sent with requests, to prevent CSRF attacks. When your request has the wrong id -- such as when you send your first request, or when the server expires the CSRF token -- the Transmission RPC server will return an HTTP 409 error with the right X-Transmission-Session-Id in its own headers. So, the correct way to handle a 409 response is to update your X-Transmission-Session-Id and to resend the previous request.

I was looking for solution either using a CXF filter or interceptor, that basically will handle the 409 response and retry the initial request adding the token header. I'm thinking that clients can persist this token and send it in future calls.

I'm not very familiar with cxf so I was wondering if this can be accomplish and how. Any hint would be helpful.

Thanks!

0 投票
0 回答
228 浏览

java - CXF-Proxy 客户端和@Suspended AsyncResponse

我最近了解到,使用 JAX-RS 2.0 长时间运行的服务端点可以利用@Suspended注释并AsyncResponse为传入请求释放资源,而实际工作在后台完成。所有客户端示例——至少是我目前发现的那些——要么直接调用此类端点(普通的 http-call),要么使用 JAX-RS 客户端 API。但是我无法弄清楚如何将它与基于代理的 API 一起使用。

给定一个 REST 端点,它使用@Suspended

它使用 Spring 的实现:

还有一个基于代理的客户端,它想要获得结果:

显然有两个问题:

  1. 我需要向heavyLifting方法提供什么作为AsyncResponse参数的值?
  2. @Suspended由于使用的方法的返回类型必须为 void ,我怎样才能得到结果?

另一个问题是如何处理服务方法中的异常。异常会自动恢复响应并返回相应的错误状态吗?

0 投票
0 回答
404 浏览

java - 没有任何政策改变。可以满足

我正在尝试使用 Apache CXF 3.0.12 和 Java JDK 1.8 创建一个 Web 服务客户端。带有 wsdl2java 的源代码生成看起来不错,但是当我尝试连接到 WS 时出现异常:

来自 WSDL 文件的 Auth 部分:

我已经尝试了论坛的一些技巧,但不幸的是没有成功。

例如:Apache CXF - 不能满足任何策略替代方案

有没有人可能提示?

谢谢。本