Method swaSend
MimeBodyPart mpb = null;
System.out.println("Application: " + applicationName);
/*
* Now do some printing to get information about the multipart
* content and the associated attachments. Axis performs
* several steps during deserialization of this SOAP
* call. Only the steps of interesst are described here.
*
* The MIME multipart that contains the other parts (because
* it's multipart/mixed or multipart/related) is handled as
* ONE Axis attachment during the first part of
* deserialization. This attachment is identified by the CID:
* prefixed string generated during serialization.
*
* The next step (see
* MimeMultipartDataHandlerDeserializer.java) gets the data
* handler of the Axis attachment and creates a MimeMultipart
* object using the data source as input of the new
* MimeMultipart object. The MimeMultipart object parses the
* input (on demand? -> this need to be clarified) and builds
* the associated body parts.
*
* The Axis attachment part is not disposed or otherwise
* managed after it was serialized into the MimeMultipart
* object. Therefore it is a good idea to call the dispose()
* method of the Axis attachment part after processing is
* complete. Doing so releases all used resources, also
* deleting disk cache files if necessary, of this attachment
* part.
*/
try {
int contCount = content.getCount();
System.out.println("Number of Mimeparts: " + contCount);
for (int i = 0; i < contCount; i++) {
mpb = (MimeBodyPart) content.getBodyPart(i);
DataHandler dh = mpb.getDataHandler();
System.out.println("Mime data type: " + dh.getContentType());
}
} catch (javax.mail.MessagingException ex) {
}
/*
* the next prints are just for information only
*/
AttachmentPart[] attParts = getMessageAttachments();
System.out.println("Number of attachements: " + attParts.length);
if (attParts.length > 0) {
try {
System.out.println("Att[0] type: "
+ attParts[0].getContentType());
System.out.println(
"Att[0] dh type: "
+ attParts[0].getDataHandler().getContentType());
System.out.println("Att[0] file: "
+ attParts[0].getAttachmentFile());
} catch (javax.xml.soap.SOAPException ex) {
}
}
/*
* Now process the parametes including the MimeMultipart
*/
/*
* Processing is done, now dispose the attachements. This is not done
* by Axis, should be done by service.
*/
MessageContext msgContext = MessageContext.getCurrentContext();
Message reqMsg = msgContext.getRequestMessage();
Attachments messageAttachments = reqMsg.getAttachmentsImpl();
messageAttachments.dispose();
return null;