我试图关注this example,目标是设置SOAP标头。
到目前为止,我的代码看起来像这样:
SomethingPortType portType = service.getPort(SomethingPortType.class);
Map<String, Object> requestHeaders = new HashMap<String, Object>();
requestHeaders.put("MyHeader1", "This is a string value");
requestHeaders.put("MyHeader2", "This is a string value2");
// Set the Map as a property on the RequestContext.
BindingProvider bp = (BindingProvider) portType;
bp.getRequestContext().put("???", requestHeaders);
我没有使用任何应用程序服务器,如何弄清楚我应该代替什么? (或来自示例的com.ibm.websphere.webservices.Constants.REQUEST_TRANSPORT_PROPERTIES)正确设置SOAP Header?
答案 0 :(得分:1)
简而言之,我错过了这一行:
bp.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, requestHeaders);