有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何创建web服务代理?我们能生成@Endpoints吗?

我正在使用审计的web服务代理(稍后使用缓存=创建自己的响应),我需要生成@Endpoints(这样只需转发,即至少调用远程web服务或虚拟)。封送/取消封送似乎是必要的,因为代理将向请求中添加“某物”

我们将使用spring ws和JAXB。已获取代理web服务的所有XSD和静态WSDL

有什么线索吗?有人做过类似的事情吗?你怎么做到的

有没有一种简单的方法可以使用spring或spring集成来实现这一点

提前谢谢


共 (1) 个答案

  1. # 1 楼答案

    这应该可以使用Spring WS和Spring集成:

    使用Spring WS,您可以为远程WS创建一个代理类,围绕一个org.springframework.ws.client.core.WebServiceTemplate与WS进行对话,WS有API负责将请求编组为xml并解组响应

    使用Spring Integration,您可以使用outbound Webservices gateway,但需要使用消息网关,它将充当您的代理,如下所示:

    <int:gateway id="wsproxy"  service-interface="..ProxyInterface" default-request-channel="requestChannel" default-reply-channel="replyChannel"/>
    
    <int-ws:outbound-gateway id="wsGateway" request-channel="requestChannel" uri="http://serviceURL" marshaller="someMarshaller" unmarshaller="someUnmarshaller"/>
    

    然而,我推荐使用WebserviceTemplate的第一种方法,因为这里没有非常复杂的集成需求