Hi, sorry my ignorance, I understand we use this line to extract the 
attachments from org.apache.synapse.MessageContext

org.apache.axis2.context.MessageContext mc = ((Axis2MessageContext) 
synCtx).getAxis2MessageContext();

but how do I add attachments to synCtx ? Can you provide the example please ?

thanks

Remsy

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Ruwan Linton
Sent: October 7, 2008 10:54 AM
To: [email protected]
Subject: Re: [esb-java-user] esb and soap attachments


Hi Resmy,

Well, the same approach works with the class mediator too...

Thanks,
Ruwan

Schmilinsky, Remsy wrote:
> Thanks a lot, it worked. Is there a similar approach to add 
> attachments from a class mediator ?
>  
> Remsy 
>
>     -----Original Message-----
>     *From:* [EMAIL PROTECTED]
>     [mailto:[EMAIL PROTECTED] Behalf Of *Asankha C.
>     Perera
>     *Sent:* October 6, 2008 4:10 PM
>     *To:* [email protected]
>     *Subject:* Re: [esb-java-user] esb and soap attachments
>
>     Hi Remsy
>>
>>      Hi. I haven't been able to exchange soap with attachments
>>     between esb and another axis2 soap server. Does esb really allow
>>     to wrap or convert the soap body  of the message context  to
>>     attachment ? I still don't know how to extract attachments from a
>>     mediator.
>>
>     If it is a custom mediator that you are writing, then you could do
>     the following:
>
>         public boolean mediate(MessageContext synCtx) {
>             org.apache.axis2.context.MessageContext mc =
>                 ((Axis2MessageContext) synCtx).getAxis2MessageContext();
>
>             String[] cids = mc.getAttachmentMap().getAllContentIDs();
>             for (int i=0; i < cids.length; i++) {
>
>                 DataHandler dh =
>     mc.getAttachmentMap().getDataHandler(cids[i]);
>                 // do something with the attachment..
>             }
>
>     Alternatively, you can extract content from an attachment and
>     replace the message payload (e.g. SOAP body etc)
>
>     If you describe your use case and what you want achieved, we could
>     help you better..
>>
>>     The examples suggest using esb as a proxy address on top of a
>>     service only (between client and servers), but there is no
>>     demonstration of how attachments can be generated or
>>     extracted  inside esb
>>
>     Yes I agree that we have to improve our samples and docs more, but
>     we do have access to add/remove or manipulate attachments..
>
>     asankha
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Esb-java-user mailing list
> [email protected]
> http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>   


_______________________________________________
Esb-java-user mailing list
[email protected]
http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user

_______________________________________________
Esb-java-user mailing list
[email protected]
http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user

Reply via email to