}
protected void createBareMessage(ServiceInfo serviceInfo,
OperationInfo opInfo, boolean isOut) {
SchemaInfo schemaInfo = null;
XmlSchema schema = null;
MessageInfo message = isOut ? opInfo.getOutput() : opInfo.getInput();
if (message.getMessageParts().size() == 0) {
return;
}
Method method = (Method)opInfo.getProperty(METHOD);
int paraNumber = 0;
for (MessagePartInfo mpi : message.getMessageParts()) {
QName qname = (QName)mpi.getProperty(ELEMENT_NAME);
if (message.getMessageParts().size() == 1) {
qname = qname == null && !isOut ? getInParameterName(opInfo, method, -1) : qname;
qname = qname == null && isOut ? getOutParameterName(opInfo, method, -1) : qname;
if (qname.getLocalPart().startsWith("arg") || qname.getLocalPart().startsWith("return")) {
qname = isOut
? new QName(qname.getNamespaceURI(), method.getName() + "Response") : new QName(qname
.getNamespaceURI(), method.getName());
}
}
if (isOut && message.getMessageParts().size() > 1 && qname == null) {
while (!isOutParam(method, paraNumber)) {
paraNumber++;
}
qname = getOutParameterName(opInfo, method, paraNumber);
} else if (qname == null) {
qname = getInParameterName(opInfo, method, paraNumber);
}
for (SchemaInfo s : serviceInfo.getSchemas()) {
if (s.getNamespaceURI().equals(qname.getNamespaceURI())) {
schemaInfo = s;
break;
}
}
if (schemaInfo == null) {
schemaInfo = getOrCreateSchema(serviceInfo, qname.getNamespaceURI(), true);
schema = schemaInfo.getSchema();
} else {
schema = schemaInfo.getSchema();
if (schema != null && schema.getElementByName(qname) != null) {
mpi.setElement(true);
mpi.setElementQName(qname);
mpi.setXmlSchema(schema.getElementByName(qname));
paraNumber++;
continue;
}
}
XmlSchemaElement el = new XmlSchemaElement();
XmlSchemaTools.setElementQName(el, qname);
el.setNillable(true);
if (!isExistSchemaElement(schema, qname)) {
SchemaCollection.addGlobalElementToSchema(schema, el);
} else {
el = getExistingSchemaElement(schema, qname);
}
if (mpi.isElement()) {
XmlSchemaElement oldEl = (XmlSchemaElement)mpi.getXmlSchema();
if (!oldEl.getQName().equals(qname)) {
el.setSchemaTypeName(oldEl.getSchemaTypeName());
el.setSchemaType(oldEl.getSchemaType());
if (oldEl.getSchemaTypeName() != null) {
addImport(schema, oldEl.getSchemaTypeName().getNamespaceURI());
}
}
mpi.setElement(true);
mpi.setXmlSchema(el);
mpi.setElementQName(qname);
mpi.setConcreteName(qname);
continue;
} else {
el.setSchemaTypeName(mpi.getTypeQName());
mpi.setXmlSchema(el);
mpi.setConcreteName(qname);
addImport(schema, mpi.getTypeQName().getNamespaceURI());
}
schemaInfo.setSchema(schema);
mpi.setElement(true);
mpi.setElementQName(qname);
paraNumber++;
}