// Exclude the header parts from the message part list.
bmsg.setMessageParts(messageParts);
}
SoapBodyInfo bodyInfo = new SoapBodyInfo();
SoapBody soapBody = SOAPBindingUtil.getSoapBody(bmsg.getExtensors(ExtensibilityElement.class));
List parts = null;
if (soapBody == null) {
MIMEMultipartRelated mmr = bmsg.getExtensor(MIMEMultipartRelated.class);
if (mmr != null) {
parts = mmr.getMIMEParts();
}
} else {
bmsg.addExtensor(soapBody);
bodyInfo.setUse(soapBody.getUse());
parts = soapBody.getParts();
}
// Initialize the body parts.
List<MessagePartInfo> attParts = null;
if (parts != null) {
List<MessagePartInfo> bodyParts = new ArrayList<MessagePartInfo>();
for (Iterator itr = parts.iterator(); itr.hasNext();) {
Object part = itr.next();
if (part instanceof MIMEPart) {
MIMEPart mpart = (MIMEPart) part;
attParts = handleMimePart(mpart, attParts, msg, bmsg, bodyParts, messageParts);
} else {
addSoapBodyPart(msg, bodyParts, (String)part);
}
}
bodyInfo.setParts(bodyParts);
bodyInfo.setAttachments(attParts);
} else {
bodyInfo.setParts(messageParts);
}
bmsg.addExtensor(bodyInfo);
}