public static void CreateFunctionClasses(String packageName) throws Exception
    {
        //work throug functions and

        for (Function fn : PropertyContainer.Functions)
        {
            //for each function get the parameter class and the return type and create the classes

            SoapClass paramClass = PropertyContainer.GetClassWithName(fn.InputType);
            SoapClass returnClass = PropertyContainer.GetClassWithName(fn.OutputType);

            

            if (paramClass != null)
            {
                InputStream file = ClassProcessor.class.getResourceAsStream("ParameterClassTemplate.txt");
                
                //set up paramClass
                if (file != null )
                {
                    String classText = FileHelper.getContents(file);

                    file.close();

                    //replace package place holder
                    classText = classText.replaceAll("%%PACKAGENAME%%", packageName);

                    //now find classname and replace that with the class name
                    classText = classText.replaceAll("%%CLASSNAME%%", paramClass.Name);

                    //now find soapmethodname placeholder and replace
                    //remove namespace from action
                    String soapAction = fn.SoapAction.replace(PropertyContainer.Namespace, "");
                    classText = classText.replaceAll("%%SOAPMETHODNAME%%", soapAction);

                    //now find namespace and replace
                    classText = classText.replaceAll("%%NAMESPACE%%", PropertyContainer.Namespace);

                    //build properties
                    //build properties insert
                    String propText = "";
                    String soapPropText = "";


                    for (SoapClassProperty prop : paramClass.Properties)
                    {

                        propText += String.format("     public %s %s;", prop.getPropertyClassType(),prop.getPropertyName()) + "\n";

                        soapPropText += String.format("     request.addProperty(\"%s\", %s);", prop.getPropertyName(),prop.getPropertyName()) + "\n";



                    }

                    //set properties 
                    classText = classText.replaceAll("%%PROPERTIES%%", propText);

                    //set soap params properties
                    classText = classText.replaceAll("%%SOAPPROPERTIES%%", soapPropText);

                    //now save to folder
                    //Get full path
                    String filePath = FileHelper.GetOutputFolderPath() + "/" + paramClass.Name + ".java";

                    //write to file
                    if (!FileHelper.WriteClassTextToFile(filePath, classText))
                    {
                        throw new Exception("unable to create parameter class file");
                    }
                }
                else
                {
                 throw new Exception("could not locatie Parameter Class template");
                }
            }
            else
            {
                throw new Exception("parameter class not found");
            }

            //now do the Return type class
            if (returnClass != null)
            {
                InputStream file = ClassProcessor.class.getResourceAsStream("ResponseTemplate.txt");

                //set up paramClass
                if (file != null )
                {
                    String classText = FileHelper.getContents(file);

                    file.close();

                    //replace package place holder
                    classText = classText.replaceAll("%%PACKAGENAME%%", packageName);

                    //now find classname and replace that with the class name
                    classText = classText.replaceAll("%%CLASSNAME%%", returnClass.Name);

                    //get first Parameter only as it a reutrn type
                    SoapClassProperty prop = returnClass.Properties.get(0);

                    //now replace Prop type and name place holders
                    if (prop.getIsComplexType())
                    {
                        //insert register text to register as seiraliable object
                        classText = classText.replaceAll("%%REGISTERTYPES%%", "new %%RESULTPROPTYPE%%().register(envelope);");
                    }
                    else
                    {
                        //remove placeholder
                        classText = classText.replaceAll("%%REGISTERTYPES%%", "");
                    }


                    //set replace the getproperty placeholder
                    classText = classText.replaceAll("%%GETPROPINFO%%",getClassTypeRetrievalString(prop.getPropertyName(),prop.getPropertyClassType()));

                    //replace the setproperty place holder
                    classText = classText.replaceAll("%%SETPROP%%",getConvertorForType(prop.getPropertyClassType()));

                    
                    //now find classname and replace that with the class name
                    classText = classText.replaceAll("%%RESULTPROPNAME%%", prop.getPropertyName());

                    //now find classname and replace that with the class name
                    classText = classText.replaceAll("%%RESULTPROPTYPE%%", prop.getPropertyClassType());


                    //now save to folder
                    //Get full path
                    String filePath = FileHelper.GetOutputFolderPath() + "/" + returnClass.Name + ".java";

                    //write to file
                    if (!FileHelper.WriteClassTextToFile(filePath, classText))
                    {
                        throw new Exception("unable to create return class file");
                    }
                }
                else
                {
                    throw new Exception("could not locatie Return Class template");
                }

            }
            else
            {
                throw new Exception("return class not found");
            }


        }
    }