Like this:
Attachments attachments = arg0.getAttachmentMap();
String[] attachmentIds = attachments.getAllContentIDs();
for (int i = 0; i < attachmentIds.length; i++) {
arg0.removeAttachment(attachmentIds[i]);
}
SOAPEnvelope env = arg0.getEnvelope();
System.out.println(env.toString());
Samisa Abeysinghe-2 wrote:
>
> StrongSteve wrote:
>> Hi!
>>
>> Thanks for your quick reply.
>> I already know how to get to the attachments, but what I want to do, is
>> log
>> everything EXCEPT the attachments! ;)
>>
>> Removing them from the message, does not work. I do not know why... :(
>>
>
> How did you remove them?
>
> Samisa...
>
>> And hints for me?
>>
>> Thanks in Advance!
>>
>> Greetings
>> Stefan
>>
>>
>> Thilina Gunarathne wrote:
>>
>>> Make sure you try the second method first :)..
>>>
>>> On Tue, Aug 12, 2008 at 12:01 AM, Thilina Gunarathne
>>> <[EMAIL PROTECTED]>wrote:
>>>
>>>
>>>> You can try traversing the whole envelope looking for <xop:include>
>>>> elements and then detach those elements from the tree.. But doing this
>>>> will
>>>> cause the attachment information in the SOAP envelope to be lost and ur
>>>> services may not function properly.
>>>>
>>>> One other thing you can try is to access the SOAP part data handler and
>>>> log
>>>> it's contents. You can do that by getting the soap part part content id
>>>> using the Attachments.getSOAPPartContentID() and then using
>>>> Attachments.getDataHandler(SOAPPartContentID) to get access to the SOAP
>>>> part
>>>> DataHandler. Then just write the contents of the DataHandler to the
>>>> output
>>>> stream.
>>>>
>>>> You can get access to the Attachments using msgCntx.getAttachmentMap()
>>>> method.
>>>>
>>>> thanks,
>>>> Thilina
>>>>
>>>>
>>>> On Mon, Aug 11, 2008 at 10:51 PM, StrongSteve
>>>> <[EMAIL PROTECTED]>wrote:
>>>>
>>>>
>>>>> Hi Everybody!
>>>>>
>>>>> I am currently developing an Axis2 Handler that logs all SOAP Messages
>>>>> targeted at my server into separate files.
>>>>> The problem is, that many of these SOAP Messages contain files (binary
>>>>> MTOM), which I do not want to log of course, as they just blow up the
>>>>> file
>>>>> size. (Instead of the binary attachment transmission I want to add a
>>>>> simple
>>>>> String like <ATTACHMENT REMOVED> or something like this.
>>>>>
>>>>> I already have everything working, except the attachment handling.
>>>>> Here
>>>>> is
>>>>> my code till now. (I have nothing with files or so on, I test it with
>>>>> plain
>>>>> System.out.printlns)
>>>>>
>>>>> public class LoggingHandler extends AbstractHandler {
>>>>>
>>>>> public InvocationResponse invoke(MessageContext msgCtx) throws
>>>>> AxisFault {
>>>>>
>>>>> SOAPEnvelope env = msgCtx.getEnvelope();
>>>>>
>>>>> System.out.println(env.toString());
>>>>>
>>>>> return InvocationResponse.CONTINUE;
>>>>>
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> So can anyone please help me with extracting the attachments?
>>>>> I would be very glad! ;)
>>>>>
>>>>> (Removing the Attachments with msgCtx.removeAttachment(AttachmentID),
>>>>> does
>>>>> not work!!!)
>>>>>
>>>>> Thanks in Advance for both your time and your knowledge!
>>>>>
>>>>> Greeting
>>>>> Stefan
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Axis2---Handler-to-log-all-messages-without-attachments-tp18938449p18938449.html
>>>>> Sent from the Axis - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Thilina Gunarathne - http://thilinag.blogspot.com
>>>>
>>>>
>>>
>>> --
>>> Thilina Gunarathne - http://thilinag.blogspot.com
>>>
>>>
>>>
>>
>>
>
>
> --
> Samisa Abeysinghe
>
> http://people.apache.org/~samisa/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Axis2---Handler-to-log-all-messages-without-attachments-tp18938449p18945302.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]