【发布时间】:2018-01-24 21:56:09
【问题描述】:
我有一个使用 spring-boot-starter-web-services 公开 SOAP Web 服务的 Spring Boot 应用程序。
我正在使用 EndpointInterceptor 获取请求的 messageContext
@Component
public class GlobalEndpointInterceptor implements EndpointInterceptor {
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
//Here I get the messageContext
}
}
在我的服务端点中,我有:
@Endpoint
public class CountryEndpoint {
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "addCountryRequest")
@ResponsePayload
public AddCountryResponse addCountry(@RequestPayload AddCountryRequest request) {
//Insert country and get the autogenerated ID
//Insert the country ID along with the messageContext retreived from the intercepter. I can't get the messageContext here !
}
}
如何在我的服务端点中检索消息上下文
【问题讨论】:
-
我建议阅读reference guide,它很好地回答了这个问题。简而言之,只需添加
MessageContext作为方法参数。
标签: java web-services spring-boot soap interceptor