try {
obj = JAXBEncoderDecoder.unmarshall(callback.getJAXBContext(),
callback.getSchema(), childNode,
elName, ClassHelper.forName(wrapperType));
} catch (ClassNotFoundException e) {
throw new WebServiceException("Could not unmarshall wrapped type (" + wrapperType + ") ", e);
}
if (isOutBound && callback.getWebResult() != null) {
Method method = callback.getMethod();
if (JAXBUtils.isAsync(method)) {
Method syncMethod = callback.getSyncMethod();
Type gtype = method.getGenericReturnType();
if (Future.class.equals(method.getReturnType())) {
Type types[] = method.getGenericParameterTypes();
if (types.length > 0 && types[types.length - 1] instanceof ParameterizedType) {
gtype = types[types.length - 1];
}
}
if (gtype instanceof ParameterizedType
&& ((ParameterizedType)gtype).getActualTypeArguments().length == 1
&& ((ParameterizedType)gtype).getActualTypeArguments()[0] instanceof Class) {
Class cls = (Class)((ParameterizedType)gtype).getActualTypeArguments()[0];
if (cls.getName().equals(wrapperType)) {
syncMethod = null;
}
}
method = syncMethod;
}
if (method != null) {
Object retVal = callback.getWrappedPart(callback.getWebResultQName().getLocalPart(),
obj,
method.getReturnType());
objCtx.setReturn(retVal);
} else {
objCtx.setReturn(obj);
}
}
WebParam.Mode ignoreParamMode = isOutBound ? WebParam.Mode.IN : WebParam.Mode.OUT;
int noArgs = callback.getMethod().getParameterTypes().length;
try {
for (int idx = 0; idx < noArgs; idx++) {
WebParam param = callback.getWebParam(idx);
if ((param.mode() != ignoreParamMode) && !param.header()) {
Class<?> cls = callback.getMethod().getParameterTypes()[idx];
if (param.mode() != WebParam.Mode.IN) {
//INOUT and OUT Params are mapped to Holder<T>.
Type[] genericParameterTypes = callback.getMethod().getGenericParameterTypes();
//ParameterizedType represents Holder<?>
ParameterizedType paramType = (ParameterizedType)genericParameterTypes[idx];
Class<?> c =
JAXBEncoderDecoder.getClassFromType(paramType.getActualTypeArguments()[0]);
Object partValue = callback.getWrappedPart(param.name(), obj, c);
//TO avoid type safety warning the Holder
//needs tobe set as below.
cls.getField("value").set(methodArgs[idx], partValue);
} else {
methodArgs[idx] = callback.getWrappedPart(param.name(), obj, cls);
}
}
}
} catch (IllegalAccessException iae) {
throw new WebServiceException("Could not unwrap the parts.", iae);
} catch (NoSuchFieldException nsfe) {
throw new WebServiceException("Could not unwrap the parts.", nsfe);
}
}