Also do u really need to log all the large attachments in your log file...
I would recommend logging only the SOAP part..
thanks,
Thilina
On Tue, Sep 2, 2008 at 7:07 AM, keith chapman <[EMAIL PROTECTED]>wrote:
> Oh this is because env.serialize will still build the axiom object model
> for you. env.serializeAndConsume can do the trick (serializes the message
> without building the object model) but the issue is that it will also
> consume the stream. May be you can try this as a workaround.
>
> Have you enabled file caching on the server? you can do this by setting the
> following properties in the axis2.xml
>
> <parameter name="enableMTOM">optional</parameter>
> <parameter name="cacheAttachments">true</parameter>
> <parameter name="attachmentDIR">work/mtom</parameter>
> <parameter name="sizeThreshold">4000</parameter>
>
> This will write the attachments which are large in size to the file system.
>
>
> Thanks,
> Keith.
>
>
> On Tue, Sep 2, 2008 at 4:08 PM, StrongSteve <[EMAIL PROTECTED]> wrote:
>
>>
>> I am not quite sure where the exception occurs, but your approach with
>> env.serialize(out) does not work either... :(
>>
>>
>>
>> keith chapman wrote:
>> >
>> > Does it happen when you perform SOAPEnvelope env =
>> > arg0.getEnvelope(); or env.toString(). Ithink it should be at the later
>> > cause env.toString() would cause the whole message to be read into
>> memory.
>> > May be you can try env.serialize(out); instead of
>> > out.write(env.toString());
>> >
>> > Thanks,
>> > Keith.
>> >
>> > On Tue, Sep 2, 2008 at 3:31 PM, StrongSteve <[EMAIL PROTECTED]>
>> wrote:
>> >
>> >>
>> >> Hi Everybody!
>> >>
>> >> I have currently developed a simple Axis handler, that logs all
>> >> incoming/outgoing messages to files on the local HDD.
>> >>
>> >> Here is my current code:
>> >>
>> >> @Override
>> >> public InvocationResponse invoke(MessageContext arg0) throws
>> >> AxisFault {
>> >>
>> >> logger.debug("entering invoke");
>> >>
>> >> SOAPEnvelope env = arg0.getEnvelope();
>> >>
>> >> String fileName = this.MESSAGE_LOGGING_DIR +
>> >> this.FILE_PRAEFIX + new
>> >> Date().getTime() +".xml";
>> >>
>> >> try {
>> >> File msgFile = new File(fileName);
>> >> FileWriter out = new FileWriter(msgFile);
>> >> out.write(env.toString());
>> >> out.close();
>> >> } catch (IOException ioex) {
>> >> logger.error(ioex.getMessage());
>> >> }
>> >>
>> >> return InvocationResponse.CONTINUE;
>> >> }
>> >>
>> >>
>> >> Unfortunately this code fails as soon as I send attachments. In this
>> >> case,
>> >> the call "SOAPEnvelope env = arg0.getEnvelope();" fails with an
>> >> OutOfMemory
>> >> Exception as not the whole SOAPEnvelope can be read into the memory.
>> >>
>> >> Does anyone have a solution or a hint on how to achive this goal with a
>> >> Streaming approach?
>> >>
>> >> Thanks in Advance for both your time and your knowledge!
>> >>
>> >> Greetings
>> >> Stefan
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Log-Incoming-Outgoing-SOAP-Messages-tp19267334p19267334.html
>> >> Sent from the Axis - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > Keith Chapman
>> > Senior Software Engineer
>> > WSO2 Inc.
>> > Oxygenating the Web Service Platform.
>> > http://wso2.org/
>> >
>> > blog: http://www.keith-chapman.org
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Log-Incoming-Outgoing-SOAP-Messages-tp19267334p19267813.html
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> Keith Chapman
> Senior Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog: http://www.keith-chapman.org
>
--
Thilina Gunarathne - http://thilinag.blogspot.com