我正在尝试对端点进行服务呼叫。当我第二次调用服务时,在基础服务类的ss.getDummyServiceHttpPort();
行上,添加了以前使用的handlerChains。即使添加了其他HandlerResolver(ss.setHandlerResolver(new JaxWsHandlerResolver(paramMap));
)也不会产生任何影响。
在第二个服务调用上,它本应使用第二个4参数处理程序链,但仍使用前3个参数处理程序链。
可能是什么原因造成的?
这是自定义的HandlerResolver
public class JaxWsHandlerResolver implements HandlerResolver {
private Map<String, Object> paramMap;
public JaxWsHandlerResolver(Map<String, Object> paramMap) {
this.paramMap = paramMap;
}
public JaxWsHandlerResolver() {
}
@SuppressWarnings("rawtypes")
public List<Handler> getHandlerChain(PortInfo info) {
List<Handler> hchain = new ArrayList<Handler>();
hchain.add(new JaxWsLoggingHandler(this.paramMap, info.getPortName().getLocalPart()));
return hchain;
}
这是第一个电话。
DummyService ss = new DummyService(new URL(
Service_URL), qName);
DummyServicePortType port = ss.getDummyServiceHttpPort();
Map<String,Object> paramMap = new HashMap<String,Object>();
paramMap.put("param1", param1);
paramMap.put("param2", param2);
paramMap.put("param3", param3);
service.setHandlerResolver(new JaxWsHandlerResolver(paramMap));
Result result = servicePort.methodFirst(param1, param2, param3);
这是第二个电话。
DummyService ss = new DummyService(new URL(
Service_URL), qName);
// On this line while getting the port the first handler chain is used
DummyServicePortType port = ss.getDummyServiceHttpPort();
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("param1", param1);
paramMap.put("param2", param2);
paramMap.put("param3", param3);
paramMap.put("param4", param4);
ss.setHandlerResolver(new JaxWsHandlerResolver(paramMap));
Result result = servicePort.methodSecond(param1, param2, param3,param4);