If you want to send the file as an MTOM Attachment, you need to use the
enableMTOM property either enabled in axis2.xml or configured in message
context.
You can use
axis2_msg_ctx_set_doing_mtom (msg_ctx, env, AXIS2_TRUE);

to enable MTOM within your code. Have a look into the mtom samples available
with axis2c.

Regards
Nandika



On Fri, Sep 17, 2010 at 5:18 PM, ramesh Gopal <[email protected]>wrote:

>
> Hello,
>
> I need some information about how we can use Axis2C and its apis to handle
> file attachments. I did read a few links, but that did not help me.
>
> I am using both Axis2C to consume and publish a web service.
>
> On the client side, I am using the following snippet :
>
>
> --------------------------------------------------------------------------------------------------------------------------
> data_handler = NULL;
> data_handler = axiom_data_handler_create(env, inreq0, mimeType);
> data_text = axiom_text_create_with_data_handler(env, text_om_node,
> data_handler, &sub_text_om_node);
> axiom_text_set_optimize(data_text, env, AXIS2_TRUE);
>
> --------------------------------------------------------------------------------------------------------------------------
>
> On the publishing side
>
> --------------------------------------------------------------------------------------------------------------------------
> result = axiom_node_get_data_element(cn, env);
> data_handler = axiom_text_get_data_handler((axiom_text_t *) result, env);
> if (data_handler)
> {
>      // My processing here
> }
>
> --------------------------------------------------------------------------------------------------------------------------
>
> This code works properly if I set the enableMTOM to true in axis2.xml file.
>
> But once I comment this line, my code doesnt work.
>
> I want to send file as an attachment only, (not as a text within message).
>
> Can you please tell me what could be going wrong.
>
> If you can help me with some working client/ server code to exchange
> attachments, it will help me all the more.
>
> Rgds,
> Ramesh
>
>
>


-- 
http://nandikajayawardana.blogspot.com/
WSO2 Inc: http://www.wso2.com

Reply via email to