gpt4 book ai didi

java - 通用 CXF 服务器实现

转载 作者:行者123 更新时间:2023-12-02 02:12:45 25 4
gpt4 key购买 nike

我目前正在开发一个使用 Spring Boot 和 CXF 的项目。我已经成功地为特定的 Web 服务(带有相关的 WSDL)创建了 SOAP 客户端和 SOAP 服务器。就像魅力一样。

现在我需要实现某种代理服务器,它只解释 SOAP header (安全性、自定义 header )并根据自定义 header 的内容将 SOAP 服务路由到不同的后端。

但我还没有找到一般处理服务调用的选项。所有在线解决方案都建议我在代理中拥有不同代理服务的所有 WSDL,并生成内部 cxf 模型。

有没有一种方法可以在没有 WSDL/内部模型的情况下完成此任务?还没找到解决办法。

我遵循的一种方法是实现自定义 CXF Implementor 并将其绑定(bind)到端点。

@Bean
public Endpoint endpoint()
{
EndpointImpl endpoint = new EndpointImpl(springBus(), customImplementor);
endpoint.publish("/proxy");

return endpoint;
}

但是没有我可以扩展的实现者接口(interface)。

我想念这里吗?您有什么建议?

最佳答案

听起来你是否需要处理程序......只需定义一个拦截器类,它们就会执行类似的操作。

@Bean
public Endpoint endpoint()
{
InterceptorClass handler = context.getBean(InterceptorClass.class);
EndpointImpl endpoint = new EndpointImpl(springBus(), customImplementor);
endpoint.setHandlers(Arrays.asList(handler));
endpoint.publish("/proxy");

return endpoint;
}

在此处查看示例 Oracle Doc如何创建拦截器类。

关于java - 通用 CXF 服务器实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49747084/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com