* @param elements
*/
private void getElementsForParts(MessageInfo message, List<ParticleInfo> elements) {
for (MessagePartInfo mpi : message.getMessageParts()) {
XmlSchemaElement element = null;
XmlSchemaType type = null;
QName diagnosticName = mpi.getName();
if (mpi.isElement()) {
element = (XmlSchemaElement)mpi.getXmlSchema();
if (element == null) {
element = XmlSchemaUtils.findElementByRefName(xmlSchemaCollection, mpi.getElementQName(),
serviceInfo.getTargetNamespace());
}
diagnosticName = element.getQName();
type = element.getSchemaType();
if (type == null) {
type = XmlSchemaUtils.getElementType(xmlSchemaCollection,
null,
element,
null);
}
} else {
// RPC (!isElement)
type = (XmlSchemaType)mpi.getXmlSchema();
if (type == null) {
type = xmlSchemaCollection.getTypeByQName(mpi.getTypeQName());
diagnosticName = type.getQName();
}
}
boolean empty = isEmptyType(type, diagnosticName);
// There's something funny about doc/bare. Since it's doc, there is no
// element in the part. There is a type. However, for some reason,
// it tends to be an anonymous complex type containing an element, and that
// element corresponds to the type of the parameter. So, we refocus on that.
if (!empty
&& type instanceof XmlSchemaComplexType
&& type.getName() == null
&& !isWrapped) {
XmlSchemaParticle betterElement = getBuriedElement((XmlSchemaComplexType) type,
diagnosticName);
if (betterElement instanceof XmlSchemaElement) {
element = (XmlSchemaElement)betterElement;