Am trying to send a soap request using jax-ws-spring framework, but there was a change request to send credentials in soap header. i have tried to implement a method where it sets the username and password in soap header, however i don't see the header displaying in the request when i monitor from TCP/IP monitor from eclipse.
@PostConstruct
public void initialize(){
try {
CaseRequestService caseRequestService = new CaseRequestService();
CaseRequestPortType caseRequestPort = caseRequestService.getCaseRequestPort();
BindingProvider bindingProvider = (BindingProvider) caseRequestPort;
Log.info("wsAddress"+wsAddress);
//bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsAddress);
Map<String, Object> requestContext = ((BindingProvider)bindingProvider).getRequestContext();
Map<String, String> requestHeaders = new HashMap<String, String>();
requestHeaders.put("username", loadConfig.getSoap_header_uid());
requestHeaders.put("Password", Base64.getDecoder().decode(loadConfig.getSoap_header_pwd().getBytes()).toString());
requestContext.put(MessageContext.HTTP_REQUEST_HEADERS, requestHeaders);
} catch (Exception ex) {
log.error("Error in initializing CaseRequestService: ", ex);
}
}