private void createWrappedMessageSchema(ServiceInfo serviceInfo, AbstractMessageContainer wrappedMessage,
AbstractMessageContainer unwrappedMessage, SchemaInfo info,
QName wrapperName) {
XmlSchema schema = info.getSchema();
info.setElement(null); // the cached schema will be no good
XmlSchemaElement el = new XmlSchemaElement();
XmlSchemaUtils.setElementQName(el, wrapperName);
SchemaCollection.addGlobalElementToSchema(schema, el);
wrappedMessage.getMessageParts().get(0).setXmlSchema(el);
XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
if (!isAnonymousWrapperTypes()) {
ct.setName(wrapperName.getLocalPart());
el.setSchemaTypeName(wrapperName);
SchemaCollection.addGlobalTypeToSchema(schema, ct);
}
el.setSchemaType(ct);
XmlSchemaSequence seq = new XmlSchemaSequence();
ct.setParticle(seq);
for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
el = new XmlSchemaElement();
XmlSchemaUtils.setElementQName(el, mpi.getName());
Map<Class, Boolean> jaxbAnnoMap = getJaxbAnnoMap(mpi);
if (mpi.isElement()) {
addImport(schema, mpi.getElementQName().getNamespaceURI());
XmlSchemaUtils.setElementQName(el, null);
XmlSchemaUtils.setElementRefName(el, mpi.getElementQName());
} else {
if (mpi.getTypeQName() != null && !jaxbAnnoMap.containsKey(XmlList.class)) {
el.setSchemaTypeName(mpi.getTypeQName());
addImport(schema, mpi.getTypeQName().getNamespaceURI());
}
el.setSchemaType((XmlSchemaType)mpi.getXmlSchema());
if (schema.getElementFormDefault().getValue().equals(XmlSchemaForm.UNQUALIFIED)) {
mpi.setConcreteName(new QName(null, mpi.getName().getLocalPart()));
} else {
mpi.setConcreteName(mpi.getName());
}
}