if (style == Style.MESSAGE) {
int messageOperType = checkMessageMethod(method);
if(messageOperType == OperationDesc.MSG_METHOD_NONCONFORMING) continue;
if (messageOperType == -1) {
throw new InternalException("Couldn't match method to any of the allowable message-style patterns!");
}
oper.setMessageOperationStyle(messageOperType);
}
// Check params
Class [] paramTypes = method.getParameterTypes();
if (paramTypes.length != oper.getNumParams())
continue;
int j;
for (j = 0; j < paramTypes.length; j++) {
Class type = paramTypes[j];
Class heldType = type;
if (Holder.class.isAssignableFrom(type)) {
heldType = JavaUtils.getHolderValueType(type);
}
ParameterDesc param = oper.getParameter(j);
QName typeQName = param.getTypeQName();
if (typeQName == null) {
// No typeQName is available. Set it using
// information from the held type.
// (Scenarios B and D)
// There is no need to try and match with
// the Method parameter javaType because
// the ParameterDesc is being constructed
// by introspecting the Method.
typeQName = tm.getTypeQName(heldType);
param.setTypeQName(typeQName);
} else {
// A type qname is available.
// Ensure that the ParameterDesc javaType
// is convertable to the Method parameter type
//
// Use the available javaType (Scenarios C and E)
// or get one from the TMR (Scenario A).
Class paramClass = param.getJavaType();
if (paramClass != null &&
JavaUtils.getHolderValueType(paramClass) != null) {
paramClass = JavaUtils.getHolderValueType(paramClass);
}
if (paramClass == null) {
paramClass = tm.getClassForQName(param.getTypeQName());
}
// This is a match if the paramClass is somehow
// convertable to the "real" parameter type. If not,
// break out of this loop.
if (!JavaUtils.isConvertable(paramClass, heldType)) {
break;
}
}
// In all scenarios the ParameterDesc javaType is set to
// match the javaType in the corresponding parameter.
// This is essential.
param.setJavaType(type);
}
if (j != paramTypes.length) {
// failed.
continue;
}
oper.setReturnClass(method.getReturnType());
// At some point we might want to check here to see if this
// Method is already associated with another Operation, but
// this doesn't seem critital.
oper.setMethod(method);
method2OperationMap.put(method, oper);
return;
}
}
// Didn't find a match. Try the superclass, if appropriate
Class superClass = implClass.getSuperclass();
if (superClass != null &&
!superClass.getName().startsWith("java.") &&
!superClass.getName().startsWith("javax.") &&
(stopClasses == null ||
!stopClasses.contains(superClass.getName()))) {
syncOperationToClass(oper, superClass);
}
// Exception if sync fails to find method for operation
if (oper.getMethod() == null) {
InternalException ie =
new InternalException(Messages.getMessage("serviceDescOperSync00",
oper.getName(),
implClass.getName()));
throw ie;
}
}