Hi guys,
I have been banging my head against the wall trying to figure out why
my examples with attachments did not work and a very similar one in
WSTK worked when we both are using the same version of axis. I
though they had changed axis code but then I figured out that the
difference was one jar file. When I included mailapi.jar in my
classpath everything works. So I decompiled the class that
threw the exception (org.apache.axis.client.Call and
org.apache.axis.Message). I found that the code which decides
whether attachments are used is the following:
public static boolean isAttachmentSupportEnabled()
{
if(checkForAttchmentSupport)
{
checkForAttchmentSupport = false;
Object obj = null;
Object obj1 = null;
try
{
Class class2 =
Class.forName("javax.activation.DataHandler");
Class class1 =
Class.forName("javax.mail.internet.MimeMultipart");
attachImpl =
Class.forName("org.apache.axis.attachments.AttachmentsImpl");
attachmentSupportEnabled = true;
}
catch(ClassNotFoundException classnotfoundexception) { }
catch(NoClassDefFoundError noclassdeffounderror) { }
}
category.debug("Attachment support is enabled" +
attachmentSupportEnabled);
return attachmentSupportEnabled;
}
This function is called from org.apache.axis.client.Call with throws the
following exception if it returns false:
age samples\message\test.txt
Exception in thread "main" java.lang.RuntimeException: No support for
attachment
s
at org.apache.axis.client.Call.addAttachmentPart(Call.java:1321)
at samples.message.testMessage.doit(testMessage.java:63)
at samples.message.testMessage.main(testMessage.java:80)
So, support of attachments depended on the presence of
javax.mail.internet.MimeMultipart class in my classpath. I don't think
this is a nice way of doing things, at least is very misleading. If this
class
was needed, then a message informing the user that he/she needs to
download the f... jar file should be printed to the command line. And not
what I got.
Regards.
Ram�n.