You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by ramesh Gopal <fa...@yahoo.com> on 2010/09/17 13:48:01 UTC

Axis2C and MTOM ... How to use Axis2C to send/ receive attachments

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




Re: Axis2C and MTOM ... How to use Axis2C to send/ receive attachments

Posted by ramesh Gopal <fa...@yahoo.com>.

I want to know more about receiving attachments.

Rgds,
Ramesh

--- On Sat, 18/9/10, Nandika Jayawardana <ja...@gmail.com> wrote:

From: Nandika Jayawardana <ja...@gmail.com>
Subject: Re: Axis2C and MTOM ... How to use Axis2C to send/ receive attachments
To: "Apache AXIS C User List" <c-...@axis.apache.org>
Date: Saturday, 18 September, 2010, 11:23 AM

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.
RegardsNandika 



On Fri, Sep 17, 2010 at 5:18 PM, ramesh Gopal <fa...@yahoo.com> 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







Re: Axis2C and MTOM ... How to use Axis2C to send/ receive attachments

Posted by Nandika Jayawardana <ja...@gmail.com>.
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 <fa...@yahoo.com>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