Hi,

I here describe an issue I faced, and an easy workaround I used.

The problem is related to the provided SMTP transport non supporting
MIME/Multipart messages : it does not seem to be a so strong limitation
as
neither SOAP requests nor SOAP responses are multipart (I still use
SOAP1.1 without attachment).

The issue is that the presence of a multipart message is currently
breaking the bridge, and that this presence may occur even without using
SoapWithAttachments.

Consider the following situation :

- the SMTP recipient for SOAP requests is [EMAIL PROTECTED]
- a request message incomes in this recipient
- the SMTP2HTTP bridge marshalls the request to the HTTP endpoint
- the endpoint invokes the appropriate stuff 
- the endpoint then provides the bridge with the SOAP return values
(status)
- the bridge attempts to send the SOAP response message. this message
has its headers set as To:[EMAIL PROTECTED] (aka the request message
From: header), From:[EMAIL PROTECTED] (aka request message To: header)
- at this point, we consider that the [EMAIL PROTECTED] recipient is
unavailable, or in any state that implies the bar.org SMTP daemon
returns a non permanent (transient) fatal error
- then the foo.org SMTP daemon will send back to [EMAIL PROTECTED] a
message describing the encountered error, and encapsulating the initial
response message. this message IS definitively a Multipart one.
- worst, depending on its config , the daemon will try to resend
periodicaly the response message, feeding the [EMAIL PROTECTED]
recipient with Multipart messages

This situation causes the SMTP2HTTP bridge to block on the first
Multipart message, without even trying to process the next ones. ie. the
bridge does not work anymore.

As a simple (and silly) workaround I modified the SMTP2HTTP.java file,
to let the bridge process the next messages after dumping a warning
trace about the presence of a Multipart message. the diff against the
original (Soap2.2) src file can be found below.

a cleaner patch should delete the multipart messages (which are actualy
_just_ warning/error messages delivered by the SMTP daemon) from the
recipient. i will code this as soon as I've free time. 

BTW, as I'm not involved in the core SOAP development, I do not know if
anyone is already working on Multipart messages support for the SMTP
transport (I
know that Apache SOAP implements this for HTTP transport), but if so I
would like to contribute (I've not enough time to start the work from
scratch)

Hope this helps
duf.

176,177c176,186
<     MimeBodyPart mbp = (MimeBodyPart) msg.getContent ();
<     byte[] ba = (byte[]) mbp.getContent ();
---
>     MimeBodyPart mbp= null;
>     byte[] ba= null;
> 
>     try {
>       mbp= (MimeBodyPart) msg.getContent();
>       ba = (byte[]) mbp.getContent ();
>     }
>     catch(ClassCastException e) {
>       System.err.println("Current message seems to be an unsupported MIME/Multipart 
>one (skiped)");
>       return;
>     }
184a194
>

Reply via email to