private int processDocElement(OperationMetaData operation, WSDLInterfaceOperation wsdlOperation, WSDLBindingOperation bindingOperation,
ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, List<WrappedParameter> wrappedParameters,
List<WrappedParameter> wrappedResponseParameters)
{
WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0];
int wsdlPosition;
QName xmlName = input.getElement();
QName xmlType = input.getXMLType();
String javaTypeName = typeMapping.getJavaTypeName(xmlType);
TypesMetaData typesMetaData = operation.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
TypeMappingMetaData typeMetaData = typesMetaData.getTypeMappingByXMLType(xmlType);
if (typeMetaData != null)
javaTypeName = typeMetaData.getJavaTypeName();
if (javaTypeName == null)
throw new WSException("Cannot obtain java type mapping for: " + xmlType);
// Check if we need to wrap the parameters
boolean isWrapped = isWrapped(seiMethodMapping, javaTypeName);
operation.getEndpointMetaData().setParameterStyle(isWrapped ? ParameterStyle.WRAPPED : ParameterStyle.BARE);
ParameterMetaData inMetaData = new ParameterMetaData(operation, xmlName, xmlType, javaTypeName);
operation.addParameter(inMetaData);
// Set the variable names
if (inMetaData.getOperationMetaData().isDocumentWrapped())
{
if (seiMethodMapping == null)
throw new IllegalArgumentException("Cannot wrap parameters without SEI method mapping");
ServiceEndpointInterfaceMapping seiMapping = seiMethodMapping.getServiceEndpointInterfaceMapping();
JavaXmlTypeMapping javaXmlTypeMapping = seiMapping.getJavaWsdlMapping().getTypeMappingForQName(xmlType);
if (javaXmlTypeMapping == null)
throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType);
Map<String, String> variableMap = createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
for (MethodParamPartsMapping partMapping : seiMethodMapping.getMethodParamPartsMappings())
{
WsdlMessageMapping wsdlMessageMapping = partMapping.getWsdlMessageMapping();
if (wsdlMessageMapping.isSoapHeader())
continue;
if (wsdlMessageMapping == null)
throw new IllegalArgumentException("wsdl-message-message mapping required for document/literal wrapped");
String elementName = wsdlMessageMapping.getWsdlMessagePartName();
// Skip attachments
if (bindingInput.getMimePart(elementName) != null)
continue;
String variable = variableMap.get(elementName);
if (variable == null)
throw new IllegalArgumentException("Could not determine variable name for element: " + elementName);
WrappedParameter wrapped = new WrappedParameter(new QName(elementName), partMapping.getParamType(), variable, partMapping.getParamPosition());
String parameterMode = wsdlMessageMapping.getParameterMode();
if (parameterMode == null || parameterMode.length() < 2)
throw new IllegalArgumentException("Invalid parameter mode for element: " + elementName);
if (!"OUT".equals(parameterMode))
wrappedParameters.add(wrapped);
if (!"IN".equals(parameterMode))
{
wrapped.setHolder(true);
// wrapped parameters can not be shared between request/response objects (accessors)
if ("INOUT".equals(parameterMode))
wrapped = new WrappedParameter(wrapped);
wrappedResponseParameters.add(wrapped);
}
}
inMetaData.setWrappedParameters(wrappedParameters);
wsdlPosition = wrappedParameters.size();
}
else
{
if (seiMethodMapping != null)
{
MethodParamPartsMapping part = seiMethodMapping.getMethodParamPartsMappingByPartName(input.getPartName());
if (part != null)
{
inMetaData.setJavaTypeName(part.getParamType());
inMetaData.setIndex(part.getParamPosition());
}