if (isWrapped)
{
QName wrappedElementName = getWebParamName(opMetaData, i, anWebParam);
String variable = convertToVariable(wrappedElementName.getLocalPart());
WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName, javaTypeName, variable, i);
wrappedParameter.setTypeArguments(convertTypeArguments(javaType, genericType));
if (mode != ParameterMode.OUT)
wrappedParameters.add(wrappedParameter);
if (mode != ParameterMode.IN)
{
wrappedParameter.setHolder(true);
// WrappedParameters can not be shared between request/response objects (accessors)
if (mode == ParameterMode.INOUT)
wrappedParameter = new WrappedParameter(wrappedParameter);
wrappedOutputParameters.add(wrappedParameter);
}
processAttachmentAnnotationsWrapped(scanResult, i, wrappedParameter);
}
else
{
QName xmlName = getWebParamName(opMetaData, i, anWebParam);
ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, javaTypeName);
paramMetaData.setInHeader(isHeader);
paramMetaData.setIndex(i);
paramMetaData.setMode(mode);
/*
* Note: The TCK enforces the following rule in the spec regarding
* partName: "This is only used if the operation is rpc style or if
* the operation is document style and the parameter style is BARE."
*
* This seems to be a flaw in the spec, because the intention is
* obviously to prevent the ambiguity of wrapped parameters that
* specify different partName values. There is, however, no reason
* that this limitation should apply to header parameters since they
* are never wrapped. In order to comply we adhere to this confusing
* rule, although I will ask for clarification.
*/
if (anWebParam != null && !opMetaData.isDocumentWrapped() && anWebParam.partName().length() > 0)
paramMetaData.setPartName(anWebParam.partName());
opMetaData.addParameter(paramMetaData);
javaTypes.add(javaType);
typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));
processAttachmentAnnotations(scanResult, i, paramMetaData);
processMIMEBinding(epMetaData, opMetaData, paramMetaData);
}
}
// Build result meta data
Class returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
String returnTypeName = returnType.getName();
if (!(returnType == void.class))
{
if (opMetaData.isOneWay())
throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");
WebResult anWebResult = method.getAnnotation(WebResult.class);
boolean isHeader = anWebResult != null && anWebResult.header();
boolean isWrappedBody = opMetaData.isDocumentWrapped() && !isHeader;
QName xmlName = getWebResultName(opMetaData, anWebResult);
if (isWrappedBody)
{
WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));
// insert at the beginning just for prettiness
wrappedOutputParameters.add(0, wrapped);
processAttachmentAnnotationsWrapped(scanResult, -1, wrapped);