"Method should not declare exceptions with an @OneWay annotation. " + method,
method);
}
}
JavaOperation operation = new JavaOperationImpl();
operation.setName(name);
// Set outputType to null for void
XMLType xmlReturnType = new XMLType(new QName(ns, "return"), null);
DataType<XMLType> returnDataType =
returnType == void.class ? null : new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType, method
.getGenericReturnType(), xmlReturnType);
List<DataType> paramDataTypes = new ArrayList<DataType>(parameterTypes.length);
Type[] genericParamTypes = method.getGenericParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
Class<?> paramType = parameterTypes[i];
XMLType xmlParamType = new XMLType(new QName(ns, "arg" + i), null);
DataTypeImpl<XMLType> xmlDataType = new DataTypeImpl<XMLType>(
UNKNOWN_DATABINDING, paramType, genericParamTypes[i],xmlParamType);
ParameterMode mode = ParameterMode.IN;
// Holder pattern. Physical types of Holder<T> classes are updated to <T> to aid in transformations.
if ( Holder.class == paramType) {
Type firstActual = getFirstActualType( genericParamTypes[ i ] );
if ( firstActual != null ) {
xmlDataType.setPhysical( (Class<?>)firstActual );
mode = ParameterMode.INOUT;
}
}
paramDataTypes.add( xmlDataType);
operation.getParameterModes().add(mode);
}
// Fault types
List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
Type[] genericFaultTypes = method.getGenericExceptionTypes();
if( method.isAnnotationPresent(AsyncFault.class) ) {
genericFaultTypes = readAsyncGenericFaultTypes( method );
} // end if
for (int i = 0; i < faultTypes.length; i++) {
Class<?> faultType = faultTypes[i];
// Only add checked exceptions
// JAXWS Specification v2.1 section 3.7 says RemoteException should not be mapped
if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))
&& (!RemoteException.class.isAssignableFrom(faultType))) {
XMLType xmlFaultType = new XMLType(new QName(ns, faultType.getSimpleName()), null);
DataType<XMLType> faultDataType =
new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, faultType, genericFaultTypes[i], xmlFaultType);
faultDataTypes.add(new DataTypeImpl<DataType>(UNKNOWN_DATABINDING, faultType, genericFaultTypes[i],
faultDataType));
}
}
DataType<List<DataType>> inputType =
new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class, paramDataTypes);
operation.setInputType(inputType);
operation.setOutputType(returnDataType);
operation.setFaultTypes(faultDataTypes);
operation.setNonBlocking(nonBlocking);
operation.setJavaMethod(method);
operations.add(operation);
}
return operations;
}