ArrayList params = new ArrayList();
ArrayList faultMessages = operation.getFaultMessages();
if (faultMessages != null && !faultMessages.isEmpty()) {
Element paramElement;
AxisMessage msg;
for (int i = 0; i < faultMessages.size(); i++) {
paramElement = doc.createElement("param");
msg = (AxisMessage) faultMessages.get(i);
if (msg.getElementQName() == null) {
throw new RuntimeException("Element QName is null for " + msg.getName() + "!");
}
//as for the name of a fault, we generate an exception
String faultComment = "";
if (msg.getDocumentation() != null){
faultComment = msg.getDocumentation().trim();
}
addAttribute(doc, "comment", faultComment, paramElement);
addAttribute(doc, "name",
(String) fullyQualifiedFaultClassNameMap.get(msg.getName()),
paramElement);
addAttribute(doc, "shortName",
(String) faultClassNameMap.get(msg.getName()),
paramElement);
// attach the namespace and the localName
addAttribute(doc, "namespace",
msg.getElementQName().getNamespaceURI(),
paramElement);
addAttribute(doc, "localname",
msg.getElementQName().getLocalPart(),
paramElement);
if (msg.getElementQName() != null) {
Element qNameElement = doc.createElement("qname");
addAttribute(doc, "nsuri", msg.getElementQName().getNamespaceURI(), qNameElement);
addAttribute(doc, "localname", msg.getElementQName().getLocalPart(), qNameElement);
paramElement.appendChild(qNameElement);
}
//the type represents the type that will be wrapped by this
//name
String typeMapping =
this.mapper.getTypeMappingName(msg.getElementQName());
addAttribute(doc, "type", (typeMapping == null)
? ""
: typeMapping, paramElement);
//add the short name
addShortType(paramElement, (msg.getElementQName() == null) ? null :
msg.getElementQName().getLocalPart());
String attribValue = (String) instantiatableMessageClassNames.
get(msg.getElementQName());
addAttribute(doc, "instantiatableType",
attribValue == null ? "" : attribValue,
paramElement);
// add an extra attribute to say whether the type mapping is
// the default
if (mapper.getDefaultMappingName().equals(typeMapping)) {
addAttribute(doc, "default", "yes", paramElement);
}
addAttribute(doc, "value", getParamInitializer(typeMapping),
paramElement);
Iterator iter = msg.getExtensibilityAttributes().iterator();
while (iter.hasNext()) {
// process extensibility attributes
}
params.add(paramElement);
}