Saturday, June 28, 2008

Difficulties with MTOM Caching

I am putting a great effort these days in order to get something working on MTOM caching stuff. I have completed most of the things in both sending and receiving ends.The main reason for the difficulties in this implementation is some of the limitations in Axis2/C http transport.First of all HTTP chunk transfer encoding is not working properly with Axis2/C. The main reason for MTOM caching support is prevent loading the entire attachment to the memory at once. So in that case when we send the attachment we need to send it as chunked. But Axis2/C transport is implemented in such a manner that it creates the whole sending buffer at once and copying the whole data to it. We can send this data as chunk but that is not what we need because we have loaded the whole data to memory.

So in the MTOM case I did following.

1. Defined a new type called axiom_mime_output_part. This will wrap a buffer or a file. In the case of file it will keep the file names and sizes.
2. when building the SOAP message with attachment instead of loading to the memory an array_list of these mime_output_parts are created.
3. In the transport we send each item in the array_list as chunks

I was able to get this to work with axis2_simple_http_server. But when I tried this with Apache it seems that Apache does not give any information to Axis2/C whether it is reading from a chunk stream or not. But for the newly implemented mime_parsing algorithm to work this detail is crucial. So I am now looking at a solution for this.

No comments: