private void addDocumentStyleInputMessageToMethodInfo()

in src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java [1548:1672]


    private void addDocumentStyleInputMessageToMethodInfo(BindingEntry bindingEntry, Operation op, MethodInfo minfo)
        throws WrapperFault
    {   
        Part part = null;
        
        // For now, skip over soap header parts.
        Iterator paramlist = op.getInput().getMessage().getParts().values().iterator();
        while (paramlist.hasNext())
        {
            part = (Part) paramlist.next();
            if (bindingEntry.isInHeaderPart(op.getName(), part.getName()))
                part = null;
            else
                break;
        }        
        
        // If no input parameter, simply return.
        if (part == null)
            return;       
            
        QName minfoqname;
        QName qname;
        
        Element element = c_symbolTable.getElement(part.getElementName());
        
        if (element == null)
        {
            // the part reference a type.
            qname = c_symbolTable.getType(part.getTypeName()).getQName();
            minfoqname = c_symbolTable.getType(part.getTypeName()).getQName();
        }
        else
        {
            qname = element.getRefType().getQName();
            minfoqname = element.getQName();
        }
        
        minfo.setInputMessage(minfoqname);

        if (qname == null)
            return;
        
        Type type = c_typeMap.getType(qname);
        if (type == null)
            throw new WrapperFault("unregistered type " + qname + " referenced");

        // For wrapped style, inner attributes and elements are added as parameters.
        // For unwrapped style, objects are used for the parameters (i.e. classes or structures).
        Iterator elementNames = type.getElementnames();
        Iterator attributes   = type.getAttributes();
        if (!minfo.isUnwrapped())
        {
            // Add input elements to method info
            while (elementNames.hasNext())
            {
                String elementname = (String) elementNames.next();
                CElementDecl eleinfo = type.getElementForElementName(elementname);
                Type innerType = eleinfo.getType();
                
                ParameterInfo pinfo = new ParameterInfo();
                pinfo.setType(innerType);
                pinfo.setParamName(elementname, c_typeMap);     
                pinfo.setArray(eleinfo.getMaxOccurs() > 1);
                pinfo.setElementName(type.getElementForElementName(elementname).getName());
                pinfo.setAnyElement(innerType.isAnyElement());
                pinfo.setNillable(eleinfo.isNillable());
                pinfo.setOptional(eleinfo.getMinOccurs() == 0);

                minfo.addInputParameter(pinfo);
            }
            
            // add input attributes to method info - TODO probably can remove this chunk of code.
            if (attributes != null)
            {
                while (attributes.hasNext())
                {
                    CContainedAttribute attr = (CContainedAttribute)attributes.next();
    
                    ParameterInfo pinfo = new ParameterInfo();
    
                    pinfo.setType(attr.getType());
                    pinfo.setParamName(attr.getName(), c_typeMap);
                    pinfo.setElementName(attr.getType().getName());
                    pinfo.setAttribute(true);
                    
                    minfo.addInputParameter(pinfo);
                }
            }
        }
        else
        { 
            // If input element is complex and does not contain any sub-elements or attributes, we ignore.
            if (type.isSimpleType() 
                    || type.isPrimitiveType()
                    || elementNames.hasNext() 
                    || (attributes != null && attributes.hasNext()))
            {
                String elementName;
                
                if (element != null)
                    elementName = element.getQName().getLocalPart();
                else
                    elementName = type.getName().getLocalPart();
                
                ParameterInfo pinfo = new ParameterInfo();
                
                pinfo.setType(type);
                type.setIsUnwrappedInputType(true);
                pinfo.setParamName(elementName, c_typeMap);
                
                if (element != null)
                    pinfo.setElementName(element.getQName());
                else
                    pinfo.setElementName(type.getName());
                
                pinfo.setAnyElement(type.isAnyElement());
    
                // Let us be nice and uppercase the first character in type name, 
                // in addition to resolving method name/type conflicts.
                type.setLanguageSpecificName(generateNewTypeName(type, minfo));
                
                minfo.addInputParameter(pinfo);
            }
        }
    }