[esb-java-user] esb and soap attachments

Asankha C. Perera asankha at wso2.com
Tue Oct 7 02:56:38 PDT 2008


Resending this reply as this got lost with the mail issues last night..

Asankha C. Perera wrote:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.wso2.org/pipermail/esb-java-user/attachments/20081007/431e7d58/attachment.htm 


More information about the Esb-java-user mailing list