[jboss-user] [JBoss Web Services] - how to update the MessageContext
suresh inala
do-not-reply at jboss.com
Wed May 26 14:20:59 EDT 2010
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&containerType=14&container=2044]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100526/4c54e858/attachment.html
More information about the jboss-user
mailing list