Hi all,
I have a question regarding synapse for which I could not get help from
stackoverflow[1]
I would like to check the message size of a SoapEnvelope of
org.apache.synapse.MessageContext to see if it exceeds a certain maximum
size. Currently it is done the following manner:
if (maxMessageSize > 0) {
FixedByteArrayOutputStream fbaos = new
FixedByteArrayOutputStream(maxMessageSize);
try {
MessageHelper.cloneSOAPEnvelope(synCtx.getEnvelope()).serialize(fbaos);
} catch (XMLStreamException e) {
handleException("Error in checking the message size",
e, synCtx);
} catch (SynapseException syne) {
synLog.traceOrDebug("Message size exceeds the upper
bound for caching, request will not be cached");
return;
} finally {
try {
fbaos.close();
} catch (IOException e) {
handleException("Error occurred while closing the
FixedByteArrayOutputStream ", e, synCtx);
}
}
}
In this case I have to serialize the envelope before checking the size
which I don't think is the most efficient way to do this. In my case I have
to check message size before all other implementations. Is there a more
efficient way to do this?
Please kindly provide the solution for the question either on stackoverflow
or here.
[1]
https://stackoverflow.com/questions/45229700/efficiently-check-the-size-of-soapenvelope-of-org-apache-synapse-messagecontext
Thank you.
Riyafa
--
Riyafa Abdul Hameed
Software Engineer, WSO2 Lanka (Pvt) Ltd <http://wso2.com/>
Email: [email protected] <[email protected]>
Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
<http://facebook.com/riyafa.ahf> <http://lk.linkedin.com/in/riyafa>
<http://twitter.com/Riyafa1>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev