suresh inala [
http://community.jboss.org/people/inalasuresh] created the discussion
"how to update the MessageContext"
To view the discussion, visit:
http://community.jboss.org/message/544930#544930
--------------------------------------------------------------
Hi Everyone,
while sending the request from the consumer with the client-handlers i want to update the
messagecontext.
for that the below code which i am working on. when iam doing this i am getting the null
response.
i am getting the soap response from the bytes but those byte are not setting into the
StreamSource
public boolean handleMessage (MessageContext msgContext) {
SOAPMessageContext smc = (SOAPMessageContext) msgContext;
SOAPMessage msg = smc.getMessage();
SOAPPart sp = msg.getSOAPPart();
StreamSource source = new StreamSource(new
ByteArrayInputStream(getMessageBytes()));
sp.setContent(source);
return false;
}
protected byte[] getMessageBytes (MessageContext msgContext) {
byte[] result = null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
((SOAPMessageContext)msgContext).getMessage().writeTo(bos);
result = bos.toByteArray();
bos.close();
log.trace("setting byte message
(length="+result.length+")");
} catch (Exception e) {
throw new WebServiceException("Error extracting SOAP request message as
bytes", e);
}
return result;
}
can any one plese help me out how can i set the bytes into MessageContext/StreamSource
Thanks & Regards
Suresh
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/544930#544930]
Start a new discussion in JBoss Web Services at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]