hello,
like poutsma said, i has implement SoapEndpointInterceptor.handleResponse()
i wanted to add an attribute Id to the soap body (to sign the body later), but when i add it:
Code:
SoapMessageContext soapMessageContext = (SoapMessageContext)messageContext;
SoapMessage messageResponse = soapMessageContext.getSoapResponse();
SoapEnvelope envelope = messageResponse.getEnvelope();
Source envelopeSource = envelope.getSource();
Document docEnvelopeSource = toDomMessagePayload(envelopeSource);
//Id attribute creation
Element body = (Element)docEnvelopeSource.getElementsByTagNameNS("http://schemas.xmlsoap.org/soap/envelope/", "Body").item(0);
logger.info("[SignatureInterceptor.handleResponse] body.getTagName(): " + body.getTagName());
body.setAttribute("Id", identificador);
when in the client look the response, the body hasn't the attribute Id, and not verify the sign.
another question, i add the Signature (firmaSource) to the header so:
Code:
QName signature = QNameUtils.toQName("http://...", "tns:firma");
SoapHeader header = messageResponse.getSoapHeader();
SoapHeaderElement headerElement = header.addHeaderElement(signature);
Result headerResult = headerElement.getResult();
transform(firmaSource, headerResult);
and the soap header is:
Code:
<SOAP-ENV:Header><tns:firma xmlns:tns="http://..."><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
...
how can i add the Signature without firma element??? like this:
Code:
<SOAP-ENV:Header><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
...
thanks in advance,
César.