【发布时间】:2016-05-10 18:11:11
【问题描述】:
作为 Spring 集成项目的一部分,我有一个 spring ws 端点,我想访问 Soap Header。当我将 SoapHeader 添加到方法参数时,我得到以下异常:
[10/05/16 05:00:05:005 PDT] localhost-startStop-1 调试 springframework.integration.util.MessagingMethodInvokerHelper.doWith(): 方法[公共 com.bstonetech.ptms.integration.model.ws.external.contract.GetContractResponse com.bstonetech.ptms.integration.service.ws.GetContractEndpoint.getContract(com.bstonetech.ptms.integration.model.ws.external.contract.GetContractRequest,org.springframework.ws.context.MessageContext) throws java.lang.Exception] 不符合消息处理的条件 不止一种参数类型候选: [@org.springframework.ws.server.endpoint.annotation.RequestPayload com.bstonetech.ptms.integration.model.ws.external.contract.GetContractRequest] 和 [org.springframework.ws.context.MessageContext]。 [10/05/16 05:00:05:005 PDT] localhost-startStop-1 警告 web.context.support.XmlWebApplicationContext.refresh():异常 在上下文初始化期间遇到 - 取消刷新尝试
java.lang.IllegalArgumentException: [class 类型的目标对象 com.bstonetech.ptms.integration.service.ws.GetContractEndpoint] 没有 处理消息的合格方法。
使用 MessageContext messageContext 也会出现同样的错误。
我显然遗漏了一些东西。任何帮助将不胜感激。
整合如下:
<oxm:jaxb2-marshaller id="contractMarshaller" context-path="com.bstonetech.ptms.integration.model.ws.external.contract"/>
<ws:inbound-gateway id="getContractWs" request-channel="inboundGetContractChannel" mapped-request-headers="fileId" mapped-reply-headers="fileId"
marshaller="contractMarshaller" unmarshaller="contractMarshaller"/>
<int:service-activator id="contractEndpoint" input-channel="inboundGetContractChannel" ref="getContractEndpoint"/>
端点如下所示:
@Endpoint
public class GetContractEndpoint {
private static final String NAMESPACE_URI = "http://bstonetech.com/contract";
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetContractRequest")
@ResponsePayload
public GetContractResponse getContract(@RequestPayload GetContractRequest request, SoapHeader soapHeader) throws Exception {
.....
}
【问题讨论】:
标签: spring-integration spring-ws