return Constants.NS_PREFIX_SOAP_ENC + ":" +
qName.getLocalPart();
}
// look up the serializer in the TypeMappingRegistry
Serializer ser = null;
SerializerFactory factory = null;
if (tm != null) {
factory = (SerializerFactory)tm.getSerializer(type);
} else {
factory = (SerializerFactory)defaultTM.getSerializer(type);
}
// If no factory is found, use the BeanSerializerFactory
// if applicable, otherwise issue errors and treat as an anyType
if (factory == null) {
if (isBeanCompatible(type, true)) {
factory = new BeanSerializerFactory(type, qName);
} else {
return null; // Don't return an element name
}
}
if (factory != null) {
ser = (Serializer)factory.getSerializerAs(Constants.AXIS_SAX);
}
// if we can't get a serializer, that is bad.
if (ser == null) {
throw new AxisFault(
JavaUtils.getMessage("NoSerializer00", type.getName()));
}
// Write the namespace
writeTypeNamespace(type, qName);
// If an array the component type should be processed first
String componentTypeName = null;
Class componentType = null;
if (type.isArray()) {
String dimString = "[]";
componentType = type.getComponentType();
if (componentType.isArray()) {
while (componentType.isArray()) {
dimString += "[]";
componentType = componentType.getComponentType();
}
}
componentTypeName = writeType(componentType, null) + dimString;
}
String soapTypeName = qName.getLocalPart();
String prefix = namespaces.getCreatePrefix(qName.getNamespaceURI());
String prefixedName = prefix+":"+soapTypeName;
// If processed before, or this is a known namespace, return
if (!addToTypesList(qName, soapTypeName))
return prefixedName;
if (type.isArray()) {
// ComplexType representation of array
Element complexType = docHolder.createElement("complexType");
writeSchemaElement(qName, complexType);
complexType.setAttribute("name", soapTypeName);
Element complexContent = docHolder.createElement("complexContent");
complexType.appendChild(complexContent);
Element restriction = docHolder.createElement("restriction");
complexContent.appendChild(restriction);
restriction.setAttribute("base",
Constants.NS_PREFIX_SOAP_ENC + ":Array");
Element attribute = docHolder.createElement("attribute");
restriction.appendChild(attribute);
attribute.setAttribute("ref",
Constants.NS_PREFIX_SOAP_ENC +":arrayType");
attribute.setAttribute(Constants.NS_PREFIX_WSDL +":arrayType",
componentTypeName );
} else {
try {
if (isEnumClass(type)) {
writeEnumType(qName, type);
} else {
ser.writeSchema(this);
}
} catch (Exception e) {
throw new AxisFault(JavaUtils.getMessage("writeSchemaProblem00", type.getName()), e);
}
}