if (namespaceMappings != null && !namespaceMappings.isEmpty()) {
// If we have a default namespace mapping, require callers to
// use that namespace.
defaultNS = (String)namespaceMappings.get(0);
}
operation.setElementQName(new QName(defaultNS, method.getName()));
operation.setMethod(method);
Class retClass = method.getReturnType();
operation.setReturnClass(retClass);
operation.setReturnType(tm.getTypeQName(method.getReturnType()));
Class [] paramTypes = method.getParameterTypes();
String [] paramNames =
ExtractorFactory.getExtractor().getParameterNamesFromDebugInfo(method);
for (int k = 0; k < paramTypes.length; k++) {
Class type = paramTypes[k];
ParameterDesc paramDesc = new ParameterDesc();
// If we have a name for this param, use it, otherwise call
// it "in*"
if (paramNames != null) {
paramDesc.setName(paramNames[k+1]);
} else {
paramDesc.setName("in" + k);
}
paramDesc.setJavaType(type);
// If it's a Holder, mark it INOUT and set the type to the
// held type. Otherwise it's IN with its own type.
Class heldClass = JavaUtils.getHolderValueType(type);
if (heldClass != null) {
paramDesc.setMode(ParameterDesc.INOUT);
paramDesc.setTypeQName(tm.getTypeQName(heldClass));
} else {
paramDesc.setMode(ParameterDesc.IN);
paramDesc.setTypeQName(tm.getTypeQName(type));
}
operation.addParameter(paramDesc);
}
// Create Exception Types
Class[] exceptionTypes = new Class[method.getExceptionTypes().length];
exceptionTypes = method.getExceptionTypes();
for (int i=0; i < exceptionTypes.length; i++) {
// Every remote method declares a java.rmi.RemoteException
if (exceptionTypes[i] != java.rmi.RemoteException.class) {
Field[] f = exceptionTypes[i].getDeclaredFields();
ArrayList exceptionParams = new ArrayList();
for (int j = 0; j < f.length; j++) {
int mod = f[j].getModifiers();
if (Modifier.isPublic(mod) &&
!Modifier.isStatic(mod)) {
QName qname = new QName("", f[j].getName());
QName typeQName = tm.getTypeQName(f[j].getType());
ParameterDesc param = new ParameterDesc(qname,
ParameterDesc.IN,
typeQName);
param.setJavaType(f[j].getType());
exceptionParams.add(param);