Jak uzyskać nagłówki SOAP
Oto prośba
<code><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.ws.server.wst.fit.cvut.cz/"> <soapenv:Header> <userId>someId</userId> </soapenv:Header> <soapenv:Body> ... </soapenv:Body> </soapenv:Envelope> </code>
i chcę to uzyskaćuserId
.
Próbowałem tego
<code>private List<Header> getHeaders() { MessageContext messageContext = context.getMessageContext(); if (messageContext == null || !(messageContext instanceof WrappedMessageContext)) { return null; } Message message = ((WrappedMessageContext) messageContext).getWrappedMessage(); return CastUtils.cast((List<?>) message.get(Header.HEADER_LIST)); } private String getHeader(String name) { List<Header> headers = getHeaders(); if (headers != null) { for (Header header : headers) { logger.debug(header.getObject()); // return header by the given name } } return null; } </code>
I to się loguje[userId : null]
. Jak mogę uzyskać wartość i dlaczegonull
tam?