//}
Block block = null;
JAXBBlockContext context = new JAXBBlockContext(packages);
AttachmentDescription attachmentDesc = pd.getAttachmentDescription();
if (attachmentDesc == null) {
// Normal Processing: Not an Attachment
// Trigger unmarshal by java type if necessary
if (unmarshalByJavaType != null && unmarshalByJavaType[i] != null) {
context.setProcessType(unmarshalByJavaType[i]);
context.setIsxmlList(pd.isListType());
}
// Unmarshal the object into a JAXB object or JAXBElement
if (pd.isHeader()) {
// Get the Block from the header
// NOTE The parameter name is always used to get the header
// element...even if the style is RPC.
String localName = pd.getParameterName();
block = message.getHeaderBlock(pd.getTargetNamespace(),
localName,
context,
factory);
} else {
if (totalBodyBlocks > 1) {
// You must use this method if there are more than one body block
// This method may cause OM expansion
block = message.getBodyBlock(index, context, factory);
} else {
// Use this method if you know there is only one body block.
// This method prevents OM expansion.
block = message.getBodyBlock(context, factory);
}
index++;
}
Element element = new Element(block.getBusinessObject(true),
block.getQName());
PDElement pde =
new PDElement(pd, element, unmarshalByJavaType == null ? null
: unmarshalByJavaType[i]);
pdeList.add(pde);
} else {
// Attachment Processing
if (attachmentDesc.getAttachmentType() == AttachmentType.SWA) {
String cid = message.getAttachmentID(swaIndex);
DataHandler dh = message.getDataHandler(cid);
Attachment attachment = new Attachment(dh, cid);
PDElement pde = new PDElement(pd, null, null, attachment);
pdeList.add(pde);