Esempio n. 1
0
string Element::renderChildren()
{
	string rend;
	ElementList elements = this->getChildElements();
	for(unsigned int i=0;i<elements.size();i++)
	{
		rend.append(elements.at(i).render());
	}
	return rend;
}
Esempio n. 2
0
void View::traverseElement(string *ss, Element* element)
{
	ss->append(generateStartOpenTag(element->getTagName()));
	ss->append(generateAttributes(element->getAttributes()));
	ss->append(generateEndOpenTag());
	ss->append(element->getText());
	ElementList elements = element->getChildElements();
	for(unsigned int i=0;i<elements.size();i++)
	{
		traverseElement(ss, elements.at(i));
	}
	ss->append(generateCloseTag(element->getTagName()));
}
Esempio n. 3
0
std::string Document::render()
{
	std::string rend = this->docType;
	rend.append(generateStartOpenTag(this->root.getTagName()));
	rend.append(generateAttributes(this->root.getAttributes()));
	rend.append(generateEndOpenTag());
	rend.append(this->root.getText());
	ElementList elements = this->root.getChildElements();
	for(unsigned int i=0;i<elements.size();i++)
	{
		rend.append(elements.at(i)->render());
	}
	rend.append(generateCloseTag(this->root.getTagName()));
	return rend;
}
Esempio n. 4
0
void Element::validateNs()
{
	if(nameSpace=="" || isValidNamespace(this, nameSpace))
	{
		ElementList elements = this->getChildElements();
		for(unsigned int i=0;i<elements.size();i++)
		{
			elements.at(i).parent = this;
			elements.at(i).validateNs();
		}
	}
	else
	{
		throw ("No namespace definition found - xmlns:" + nameSpace);
	}
}
Esempio n. 5
0
string Element::render()
{
	string rend;
	rend.append(generateStartOpenTag(this->getTagName()));
	rend.append(generateAttributes(this->getAttributes()));
	//rend.append(generateAttributes(this->namespaces));
	rend.append(generateEndOpenTag());
	rend.append(this->getText());
	ElementList elements = this->getChildElements();
	for(unsigned int i=0;i<elements.size();i++)
	{
		rend.append(elements.at(i).render());
	}
	rend.append(generateCloseTag(this->getTagName()));
	return rend;
}
Esempio n. 6
0
string Element::renderSerialization()
{
	string rend;
	rend.append(generateStartOpenTag(this->getTagName()));
	rend.append(generateAttributes(this->getAttributes()));
	//rend.append(" namespace=\""+getNameSpcValue()+"\"");
	rend.append(generateEndOpenTag());
	rend.append(this->getText());
	ElementList elements = this->getChildElements();
	for(unsigned int i=0;i<elements.size();i++)
	{
		rend.append(elements.at(i)->renderSerialization());
	}
	rend.append(generateCloseTag(this->getTagName()));
	return rend;
}
Esempio n. 7
0
Element* Document::getElementByName(const std::string& name, Element* ele)
{
	if(ele->getTagName()==name)
		return ele;
	else
	{
		ElementList chi = ele->getChildElements();
		for(unsigned int i=0;i<chi.size();i++)
		{
			Element* ele1 = getElementByName(name, chi.at(i));
			if(ele1!=NULL)
			{
				return ele1;
			}
		}
	}
	return NULL;
}
Esempio n. 8
0
void OlaVB::initialize(ElementList& elements,unsigned int num,OlaVBParam::VBO_TYPE vbot)
{
	release();

	mVertnum = num;
	mVertstride = 0;

	mElements.clear();
	for (unsigned int i = 0 ; i < elements.size() ; i++)
	{			
		OlaVBParam::VB_ELEMENT_TYPE type = elements[i];	
		mElementPos[type] = i;
		int stride = OlaVBParam::getVertexElementStride(type);
		if(stride != -1)
			mVertstride += stride;

		int offset = 0;
		for (unsigned int j = 0 ; j < i ; j++)
		{
			OlaVBParam::VB_ELEMENT_TYPE type_per = elements[j];
			int stride_per = OlaVBParam::getVertexElementStride(type_per);
			assert(stride_per != -1);
			offset += stride_per;
		}

		if(i == 0)
			mElementOffset[type] = 0;
		else if(offset != 0)
			mElementOffset[type] = offset;
		else
			mElementOffset[type] = -1;

		mElements.push_back(type);
	}

	if(mVertstride != 0 && mVertnum != 0)
	{
		mBuffer = malloc(mVertstride * mVertnum);
	}

	mVBOType = vbot;
}
Esempio n. 9
0
std::string ApplicationUtil::buildAllApplications(const std::vector<std::string>& files, const std::vector<std::string>& apps)
{
	std::string headers = "#include \"fstream\"\n#include \"string\"\n#include \"HttpSession.h\"\n#include \"CastUtil.h\"\n\n";
	std::string code;
	std::string meth,methdef,vars;
	for (unsigned int var = 0; var < files.size(); ++var)
	{
		std::string path = files.at(var).substr(0,files.at(var).find_last_of("/")+1);
		std::string appName = apps.at(var).substr(0,apps.at(var).find_last_of("/"));

		XmlParser parser("Parser");
		Document doc;
		parser.readDocument(files.at(var), doc);
		const Element& root = doc.getRootElement();
		ElementList eles = root.getChildElements();
		if(eles.size()==0)
		{
			ConfigurationData::getInstance()->applicationFlowMap[appName] = false;
		}
		else
		{
			meth += "std::string "+appName+"checkRules(std::string to,HttpSession session)\n{\nstd::string curr=session.getAttribute(\"CURR\");\n";
			for (unsigned int var = 0; var < eles.size(); var++)
			{
				if(eles.at(var)->getTagName()=="include")
				{
					std::string inc = eles.at(var)->getText();
					strVec incs;
					StringUtil::split(incs, inc, (" "));
					for (unsigned int i = 0; i < incs.size(); i++)
					{
						headers += ("#include \"" + incs.at(i) + "\"\n");
					}
				}
				else if(eles.at(var)->getTagName()=="page" || eles.at(var)->getTagName()=="welcome")
				{
					meth += ("std::string " + eles.at(var)->getAttribute("id") + " = \""+path+eles.at(var)->getAttribute("path")+"\";\n");
					if(eles.at(var)->getAttribute("who")!="" && eles.at(var)->getAttribute("where")!="")
					{
						if(eles.at(var)->getAttribute("where").find("FILE:")!=std::string::npos)
						{
							std::string fileName = eles.at(var)->getAttribute("where");
							StringUtil::replaceFirst(fileName,"FILE:","");
							fileName = (path + fileName);
							meth += "std::string path;\nif(to=="+eles.at(var)->getAttribute("id")+")\n{";
							meth += "std::string user = session.getAttribute(\"USER\");\n";
							meth += "std::string pass = session.getAttribute(\"PASS\");\n";
							meth += "ifstream f(\""+fileName+"\");\n";
							meth += "if(f.is_open())\n{\nstd::string temp;\nwhile(getline(f,temp,'\\n'))\n{\n";
							meth += "if(temp==(user+\" \"+pass))\n{\nf.close();path = "+eles.at(var)->getAttribute("id");
							meth += ";break;}\n}\nf.close();\n}\nif(path==\"\")\npath=\"FAILED\";\n}\n";
						}
					}
					else if(eles.at(var)->getAttribute("onsuccess")!="" && eles.at(var)->getAttribute("onfail")!="")
					{

					}
				}
				else if(eles.at(var)->getTagName()=="rule")
				{
					meth += "\nif(to=="+eles.at(var)->getAttribute("topage")+" && curr=="+eles.at(var)->getAttribute("currpage")+")\n{";
					ElementList elesc = eles.at(var)->getChildElements();
					for (unsigned int var1 = 0; var1 < elesc.size(); var1++)
					{
						if(elesc.at(var1)->getTagName()=="execute")
						{
							std::string call = elesc.at(var1)->getAttribute("call");
							std::string clas = call.substr(0,call.find("."));
							std::string method = call.substr(call.find(".")+1);
							headers += ("#include \""+clas+".h\"\n");
							meth += clas + " _object;\n";
							std::string args;
							ElementList elesce = elesc.at(var1)->getChildElements();
							for (unsigned int var2 = 0; var2 < elesce.size(); var2++)
							{
								meth += (elesce.at(var2)->getTagName() + " _" + CastUtil::lexical_cast<std::string>(var2+1) + " = CastUtil::lexical_cast<"+elesce.at(var2)->getTagName()+">(\""+elesce.at(var2)->getText()+"\");\n");
								args += ("_"+CastUtil::lexical_cast<std::string>(var2+1));
								if(var2!=elesce.size()-1)
									args += ",";
							}
							if(elesc.at(var1)->getAttribute("rettype")!="" || elesc.at(var1)->getAttribute("rettype")!="void")
							{
								meth += (elesc.at(var1)->getAttribute("rettype") + " " + elesc.at(var1)->getAttribute("retname") + " = ");
								meth += "_object."+method+"("+args+");\n";
							}
						}
					}
					meth += "path=to;\n}\n";
				}
			}
			meth += "return path;}\n";
			code += methdef;
			ConfigurationData::getInstance()->applicationFlowMap[appName] = true;
		}
	}
	code += (headers + "extern \"C\"\n{\n"+vars+meth+"}\n");
	return code;

}
Esempio n. 10
0
void* ComponentHandler::service(void* arg)
{
	int fd = *(int*)arg;
	init();
	string methInfo,retValue;
	_cmp_instance->getServer()->Receive(fd,methInfo,1024);
	methInfo =methInfo.substr(0,methInfo.find_last_of(">")+1);
	_cmp_instance->logger << methInfo << flush;
	try
	{
		XmlParser parser("Parser");
		_cmp_instance->logger << "\nBean call parsed successfully\n" << flush;
		if(methInfo.find("lang=\"c++\"")!=string::npos || methInfo.find("lang='c++'")!=string::npos)
		{
			Document doc = parser.getDocument(methInfo);
			Element message = doc.getRootElement();
			if(message.getTagName()!="service")
			{
				throw new ComponentHandlerException("No service Tag\n",retValue);
			}
			if(message.getAttributes().size()<4)
			{
				throw new ComponentHandlerException("name,beanName,returnType and lang are mandatory attributes\n",retValue);
			}
			else if(message.getAttribute("name")=="")
			{
				throw new ComponentHandlerException("name attribute missing\n",retValue);
			}
			else if(message.getAttribute("returnType")=="")
			{
				throw new ComponentHandlerException("returnType attribute missing\n",retValue);
			}
			else if(message.getAttribute("beanName")=="")
			{
				throw new ComponentHandlerException("beanName attribute missing\n",retValue);
			}
			else if(message.getAttribute("lang")=="")
			{
				throw new ComponentHandlerException("lang attribute missing\n",retValue);
			}
			if(message.getChildElements().size()!=1)
			{
				throw new ComponentHandlerException("message tag should have only one child tag\n",retValue);
			}
			else if(message.getChildElements().at(0).getTagName()!="args")
			{
				throw new ComponentHandlerException("message tag should have an args child tag\n",retValue);
			}
			Serialize ser;
			Reflector reflector;
			args argus;
			vals valus;
			ElementList argts = message.getChildElements().at(0).getChildElements();
			for (unsigned var = 0; var < argts.size();  var++)
			{
				void *value = NULL;
				Element arg = argts.at(var);
				if(arg.getTagName()!="argument")
					throw new ComponentHandlerException("Invalid Tag, only argument tag allowed\n",retValue);
				else if(arg.getAttribute("type")=="")
					throw new ComponentHandlerException("every argument tag should have a type attribute\n",retValue);
				if(arg.getText()=="" && arg.getChildElements().size()==0)
					throw new ComponentHandlerException("argument value missing\n",retValue);
				if(arg.getAttribute("type")!="")
				{
					Element obj = arg.getChildElements().at(0);
					string objxml = obj.render();
					string objClassName = obj.getTagName();
					value = ser.unSerializeUnknown(objxml,arg.getAttribute("type"));
				}
				argus.push_back(arg.getAttribute("type"));
				valus.push_back(value);
			}
			string className = "Component_"+message.getAttribute("beanName");
			_cmp_instance->logger << "\nBean class = " << className << "\n" << flush;
			string returnType = message.getAttribute("returnType");
			string lang = message.getAttribute("lang");
			ClassInfo clas = reflector.getClassInfo(className);
			string methodName = message.getAttribute("name");
			_cmp_instance->logger << "\nBean service = " << methodName << "\n" << flush;
			if(clas.getClassName()=="")
			{
				throw new ComponentHandlerException("bean does not exist or is not regsitered\n",retValue);
			}
			Method meth = clas.getMethod(methodName,argus);
			if(meth.getMethodName()=="")
			{
				throw new ComponentHandlerException("service does not exist for the bean or the bean does not exist or is not regsitered\n\n",retValue);
			}
			else
			{
				_cmp_instance->logger << "\nGot Bean service " << methodName << "\n" << flush;
				args argus;
				Constructor ctor = clas.getConstructor(argus);
				void *_temp = reflector.newInstanceGVP(ctor);
				_cmp_instance->logger << "\nGot Bean " << _temp << "\n" << flush;
				if(returnType=="void" || returnType=="")
				{
					_cmp_instance->logger << "\nVoid return " << "\n" << flush;
					reflector.invokeMethod<void*>(_temp,meth,valus);
					retValue = ("<return:void></return:void>");
				}
				else
				{
					_cmp_instance->logger << "\nReturn type = "<< returnType << "\n" << flush;
					if(returnType=="int")
					{
						int retv = reflector.invokeMethod<int>(_temp,meth,valus);
						retValue = ("<return:int>"+CastUtil::lexical_cast<string>(retv)+"</return:int>");
					}
					else if(returnType=="float")
					{
						float retv = reflector.invokeMethod<float>(_temp,meth,valus);
						retValue = ("<return:float>"+CastUtil::lexical_cast<string>(retv)+"</return:float>");
					}
					else if(returnType=="double")
					{
						double retv = reflector.invokeMethod<double>(_temp,meth,valus);
						retValue = ("<return:double>"+CastUtil::lexical_cast<string>(retv)+"</return:double>");
					}
					else if(returnType=="string")
					{
						string retv = reflector.invokeMethod<string>(_temp,meth,valus);
						retValue = ("<return:string>"+retv+"</return:string>");
					}
					else if(returnType!="")
					{
						void* retobj = reflector.invokeMethodUnknownReturn(_temp,meth,valus);
						string oxml = ser.serializeUnknown(retobj,returnType);
						retValue = ("<return:"+returnType+">"+oxml+"</return:"+returnType+">");
					}
				}

			}
		}
		else
		{
			retValue = "<return:exception>This is a C++ daemon</return:exception>";
		}
		_cmp_instance->logger << "\nSending data = "<< retValue << "\n" << flush;
		if(retValue!="")
			_cmp_instance->getServer()->Send(fd,retValue);
		//close(fd);
	}
	catch(ComponentHandlerException *e)
	{
		_cmp_instance->logger << e->getMessage() << flush;
		_cmp_instance->getServer()->Send(fd,retValue);
		close(fd);
	}
	catch(...)
	{
		_cmp_instance->logger << "exception occurred" << flush;
		retValue = ("<return:exception>XmlParseException occurred</return:exception>");
		_cmp_instance->getServer()->Send(fd,retValue);
		close(fd);
	}
}
Esempio n. 11
0
string WsUtil::generateWSDL(string file,map<string, ClassStructure> allclsmap,string resp,string &headers,map<string,string> &wsmap,string appname,string ip_address, Reflection ref)
{
	XmlParser parser("Parser");
	Document doc = parser.getDocument(file);
	Element root = doc.getRootElement();
	typedef vector<Element> ElementList;
	typedef map<string,string> strMap;
	typedef map<string,strMap> meth_Map;
	typedef map<string,meth_Map> ws_inp_out_Map;
	ElementList wsvcs = root.getChildElements();
	if(wsvcs.size()==0)
		return "";

	string ws_funcs,obj_mapng,retObj_xml;
	for(unsigned int ii=0;ii<wsvcs.size();ii++)
	{
		ws_inp_out_Map ws_info;
		meth_Map meth_info;
		StringContext gcntxt;
		string ws_name,reqr_res_bind,wsdl_msgs,wsdl_ops,wsdl_bind,wsdl,wsdl_obj_bind;
		Element ws = wsvcs.at(ii);
		ws_name = ws.getAttribute("class");
		string ows_name = ws_name;
		StringUtil::replaceAll(ws_name, "::", "_");
		if(StringUtil::trimCopy(ws_name)=="")
		{
			logger << ("No class name defined for web-service, skipping...") << endl;
			continue;
		}
		if(StringUtil::trimCopy(ws.getAttribute("location"))=="")
		{
			logger << ("No location defined for web-service, skipping...") << endl;
			continue;
		}
		gcntxt["WS_NAME"] = ws_name;
		gcntxt["WS_PATH"] = ws.getAttribute("location");
		if(gcntxt["WS_PATH"].at(0)=='/')
		{
			gcntxt["WS_PATH"] = gcntxt["WS_PATH"].substr(1);
			StringUtil::replaceAll(gcntxt["WS_PATH"], "//", "/");
		}
		gcntxt["WS_NMSPC"] = StringUtil::trimCopy(ws.getAttribute("namespace"));

		logger << ("Web service " + ws_name + " found for appname " + appname) << endl;

		ClassStructure *clstruct = NULL;
		map<string, ClassStructure>::iterator it;
		for (it=allclsmap.begin();it!=allclsmap.end();++it)
		{
			if(it->second.getFullyQualifiedClassName()==ws.getAttribute("class"))
			{
				clstruct = &it->second;
				break;
			}
		}
		if(clstruct==NULL)
		{
			logger << ("Error generating web-service artifacts, as class "+ws.getAttribute("class") + "not found...") << endl;
			continue;
		}

		if(clstruct->getNamespace()=="" && gcntxt["WS_NMSPC"]=="")
		{
			logger << ("No namespace defined for web-service, skipping...") << endl;
			continue;
		}
		if(gcntxt["WS_NMSPC"]=="")
		{
			gcntxt["WS_NMSPC"] = clstruct->getNamespace();
		}
		StringUtil::replaceAll(gcntxt["WS_NMSPC"], "::", ".");

		vector<string> pinfo;
		bool isOpForSet = false;
		strVec info = ref.getAfcObjectData(*clstruct,false,pinfo,isOpForSet);
		headers.append("#include \""+ref.getClassPath(clstruct->getTreatedClassName(true))+"\"\n");

		set<string> allnmspcs;
		map<string, string> trgnms;
		for(unsigned int i=0;i<info.size();i++)
		{
			string temp,temp11;
			strMap in_out_info;
			temp = info.at(i);
			temp11 = temp.substr(temp.find("(")+1);
			temp = temp.substr(0,temp.find("("));
			temp11 = temp11.substr(0, temp11.find(")"));

			//StringUtil::replaceFirst(temp,"("," ");
			StringUtil::replaceAll(temp11,";","");
			StringUtil::replaceFirst(temp11,")","");
			strVec results,results1;
			StringUtil::split(results, temp, (" "));
			RegexUtil::replace(temp11, "[ \\t]*,[ \\t]", ",");
			StringUtil::split(results1, temp11, (","));

			string retType,methName,inp_params;
			if(results.size()<2)
				continue;
			if(results.size()>0 && (results.at(0)==it->second.getTreatedClassName(false) || temp.find("~")!=string::npos))
				continue;

			methName = results.at(1);

			in_out_info["RETURN"] = ws.getElementByName(methName).getAttribute("outname");
			if(in_out_info["RETURN"]=="")
				in_out_info["RETURN"] = "result";
			//logger << in_out_info["RETURN"] << flush;
			in_out_info["RETURNTYP"] = results.at(0);
			string xsdobjdef;
			if(results.at(0).find("vector<")!=string::npos)
			{
				string vecn = results.at(0);
				StringUtil::replaceFirst(vecn,"std::"," ");
				StringUtil::replaceFirst(vecn,"vector<"," ");
				StringUtil::replaceFirst(vecn,">"," ");
				StringUtil::trim(vecn);
				if(vecn=="int" || vecn=="string" || vecn=="short" || vecn=="float" || vecn=="double" || vecn=="bool" || vecn=="long long" || vecn=="long"
						|| vecn=="unsigned int" || vecn=="unsigned short" || vecn=="unsigned long long" || vecn=="unsigned long")
				{
					if(vecn=="long long")
					{
						vecn = "long";
					}
					else if(vecn=="unsigned long long")
					{
						vecn = "unsignedlong";
					}
					else if(vecn.find("unsigned")==0)
					{
						StringUtil::replaceAll(vecn, " ", "");
					}
					else if(vecn=="bool")
					{
						vecn = "boolean";
					}
					retType = "\n<xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\""+in_out_info["RETURN"]+"\" type=\"xsd:"+vecn+"\"/>";
				}
				else
				{
					string trgnmspc;
					string fqcn = ref.getFullyQualifiedClassName(vecn, clstruct->getNamespaces());
					if(trgnms.find(fqcn)==trgnms.end())
					{
						xsdobjdef = ref.getXSDDefinitions(allclsmap, fqcn, ref, appname, trgnmspc, allnmspcs, gcntxt["WS_NMSPC"], resp);
						trgnms[fqcn] = trgnmspc;
					}
					else
						trgnmspc = trgnms[fqcn];
					logger << "in result " + vecn + " " + trgnmspc << endl;
					if(vecn.find("::")!=string::npos)
						vecn = vecn.substr(vecn.find_last_of("::")+1);
					logger << "in result after " + vecn + " " + trgnmspc << endl;
					retType = "\n<xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\""+in_out_info["RETURN"]+"\" type=\""+trgnmspc+":"+vecn+"\"/>";
				}
			}
			else
			{
				if(results.at(0)!="void")
				{
					if(results.at(0)=="int" || results.at(0)=="string" || results.at(0)=="short" || results.at(0)=="float" || results.at(0)=="double"
							|| results.at(0)=="bool" || results.at(0)=="long long" || results.at(0)=="long"
							|| results.at(0)=="unsigned int" || results.at(0)=="unsigned short" || results.at(0)=="unsigned long long"
							|| results.at(0)=="unsigned long")
					{
						if(results.at(0)=="long long")
						{
							results.at(0) = "long";
						}
						else if(results.at(0)=="unsigned long long")
						{
							results.at(0) = "unsignedlong";
						}
						else if(results.at(0).find("unsigned")==0)
						{
							StringUtil::replaceAll(results.at(0), " ", "");
						}
						else if(results.at(0)=="bool")
						{
							results.at(0) = "boolean";
						}
						retType = "\n<xsd:element name=\""+in_out_info["RETURN"]+"\" type=\"xsd:"+results.at(0)+"\"/>";
					}
					else
					{
						string type = results.at(0);
						string trgnmspc;
						string fqcn = ref.getFullyQualifiedClassName(type, clstruct->getNamespaces());
						if(trgnms.find(fqcn)==trgnms.end())
						{
							xsdobjdef = ref.getXSDDefinitions(allclsmap, fqcn, ref, appname, trgnmspc, allnmspcs, gcntxt["WS_NMSPC"], resp);
							trgnms[fqcn] = trgnmspc;
						}
						else
							trgnmspc = trgnms[fqcn];
						logger << "in result " + type + " " + trgnmspc << endl;
						if(type.find("::")!=string::npos)
							type = type.substr(type.find_last_of("::")+1);
						logger << "in result after " + type + " " + trgnmspc << endl;
						retType = "\n<xsd:element name=\""+in_out_info["RETURN"]+"\" type=\""+trgnmspc+":"+type+"\"/>";
					}
				}
			}
			wsdl_obj_bind.append(xsdobjdef);

			for(unsigned int j=0;j<results1.size();j++)
			{
				string type;
				strVec results2;
				StringUtil::split(results2, results1.at(j), (" "));
				if(results2.size()<2)
				{
					results2.push_back("in"+CastUtil::lexical_cast<string>(j+1));
				}
				type = results2.at(0);
				int srn = j;
				stringstream ss;
				ss << srn;
				string te;
				ss >> te;
				if(type=="int" || type=="string" || type=="short" || type=="float" || type=="double" || type=="bool" || type=="long long" || type=="long"
						|| type=="unsigned int" || type=="unsigned short" || type=="unsigned long long" || type=="unsigned long")
				{
					string ttyp = type;
					if(type=="long long")
					{
						type = "long";
					}
					else if(type=="unsigned long long")
					{
						type = "unsignedlong";
					}
					else if(type.find("unsigned")==0)
					{
						StringUtil::replaceAll(type, " ", "");
					}
					else if(type=="bool")
					{
						type = "boolean";
					}
					inp_params.append("\n<xsd:element name=\""+results2.at(1)+"\" type=\"xsd:"+type+"\"/>");
					in_out_info[results2.at(1)] = ttyp;
				}
				else if(type!="")
				{
					if(results2.size()>=2)
					{
						in_out_info[results2.at(1)] = type;
					}
					else
					{
						logger << ("Invalid thing happening " + results1.at(j)) << endl;
					}
					strMap allfs,tyfs;
					string xsdobjdef, xdstype;
					if(type.find("vector<")!=string::npos && results2.size()==2)
					{
						string vecn = type;
						StringUtil::replaceFirst(vecn,"vector<"," ");
						StringUtil::replaceFirst(vecn,"std::"," ");
						StringUtil::replaceFirst(vecn,">"," ");
						StringUtil::trim(vecn);
						if(vecn=="int" || vecn=="short" || vecn=="float" || vecn=="double" || vecn=="bool" || vecn=="long long" || vecn=="long"
								|| vecn=="string" || vecn=="unsigned int" || vecn=="unsigned short" || vecn=="unsigned long long" || vecn=="unsigned long")
						{
							if(vecn=="long long")
							{
								vecn = "long";
							}
							else if(vecn=="unsigned long long")
							{
								vecn = "unsignedlong";
							}
							else if(vecn.find("unsigned")==0)
							{
								StringUtil::replaceAll(vecn, " ", "");
							}
							else if(vecn=="bool")
							{
								vecn = "boolean";
							}
							type = "std::vector<" + vecn + ">";
							inp_params.append("\n<xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\""+results2.at(1)+"\" type=\"xsd:"+vecn+"\"/>");
						}
						else
						{
							string trgnmspc;
							string fqcn = ref.getFullyQualifiedClassName(vecn, clstruct->getNamespaces());
							type = "std::vector<" + fqcn + ">";
							if(trgnms.find(fqcn)==trgnms.end())
							{
								xsdobjdef = ref.getXSDDefinitions(allclsmap, fqcn, ref, appname, trgnmspc, allnmspcs, gcntxt["WS_NMSPC"], resp);
								trgnms[fqcn] = trgnmspc;
							}
							else
								trgnmspc = trgnms[fqcn];
							logger << "in result " + vecn + " " + trgnmspc << endl;
							if(vecn.find("::")!=string::npos)
								vecn = vecn.substr(vecn.find_last_of("::")+1);
							logger << "in result after " + vecn + " " + trgnmspc << endl;
							inp_params.append("\n<xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\""+results2.at(1)+"\" type=\""+trgnmspc+":"+vecn+"\"/>");
						}
					}
					else if(results2.size()==2)
					{
						string trgnmspc;
						string fqcn = ref.getFullyQualifiedClassName(type, clstruct->getNamespaces());
						if(trgnms.find(fqcn)==trgnms.end())
						{
							xsdobjdef = ref.getXSDDefinitions(allclsmap, fqcn, ref, appname, trgnmspc, allnmspcs, gcntxt["WS_NMSPC"], resp);
							trgnms[fqcn] = trgnmspc;
						}
						else
							trgnmspc = trgnms[fqcn];
						logger << "in result " + type + " " + trgnmspc << endl;
						if(type.find("::")!=string::npos)
							type = type.substr(type.find_last_of("::")+1);
						logger << "in result after " + type + " " + trgnmspc << endl;
						inp_params.append("\n<xsd:element minOccurs=\"0\" name=\""+results2.at(1)+"\" type=\""+trgnmspc+":"+type+"\"/>");
					}

					wsdl_obj_bind.append(xsdobjdef);
				}
			}
			meth_info[methName] = in_out_info;
			StringContext cntxt;
			cntxt["METH_NAME"] = methName;
			cntxt["RET_TYPE"] = retType;
			cntxt["INP_PARAMS"] = inp_params;
			reqr_res_bind.append("\n"+TemplateEngine::evaluate(resp+"templateReqRes.wsdl",cntxt));
			wsdl_msgs.append("\n"+TemplateEngine::evaluate(resp+"templateWsdlMsg.wsdl",cntxt));
			wsdl_ops.append("\n"+TemplateEngine::evaluate(resp+"templateWsdlOpe.wsdl",cntxt));
			wsdl_bind.append("\n"+TemplateEngine::evaluate(resp+"templateWsdlBind.wsdl",cntxt));
		}
		ws_info[ows_name] = meth_info;
		gcntxt["REQ_RES_BINDING"] = reqr_res_bind;
		gcntxt["WSDL_MESSAGES"] = wsdl_msgs;
		gcntxt["WSDL_OPERATIONS"] = wsdl_ops;
		gcntxt["WSDL_BINDING"] = wsdl_bind;
		gcntxt["OBJ_BINDING"] = wsdl_obj_bind;
		string extranmspcs;
		if(allnmspcs.size()>0)
		{
			set<string>::iterator it;
			for(it=allnmspcs.begin();it!=allnmspcs.end();++it) {
				string nmspcid = *it;
				if(nmspcid!="tns")
				{
					string nmspcidval = Reflection::getNameSpaceIdValue(nmspcid);
					if(nmspcidval!="") {
						extranmspcs.append(" xmlns:" + nmspcid + "=\""+nmspcidval+"\"");
					}
				}
			}
		}
		gcntxt["EXTR_NMSPCS"] = extranmspcs;
		gcntxt["URL"] = "http://" + ip_address + "/" + appname;
		string wspath = gcntxt["URL"] + "/" + gcntxt["WS_PATH"];
		wsmap[wspath] = ws_name;
		wsdl = TemplateEngine::evaluate(resp+"template.wsdl",gcntxt);
		AfcUtil::writeTofile(resp+"../web/"+appname+"/public/"+ws_name+".wsdl",wsdl,true);
		//ws_funcs.append(obj_mapng);
		//ws_funcs.append(retObj_xml);
		//ws_funcs.append("extern \"C\"\n{\n");
		ws_inp_out_Map::iterator iter;
		for(iter=ws_info.begin();iter!=ws_info.end();iter++)
		{
			string ws_n = iter->first;
			meth_Map meth = iter->second;
			meth_Map::iterator iter1;
			for(iter1=meth.begin();iter1!=meth.end();iter1++)
			{
				string me_n = iter1->first;
				strMap pars = iter1->second;
				string ws_nn = ws_n;
				StringUtil::replaceAll(ws_nn, "::", "_");
				ws_funcs.append("string "+appname+me_n+ws_nn+"(Element* _req)\n{\nElement ele;\n");
				ws_funcs.append("string _retStr;\n");
				ws_funcs.append("try{\n/*_req->validateNs();*/\n");
				strMap::iterator iter2;
				string args;
				unsigned int ter = 1;
				//logger << me_n << ws_n << pars.size() << endl;
				for(iter2=pars.begin();iter2!=pars.end();iter2++)
				{
					if(iter2->first!="RETURN" && iter2->first!="RETURNTYP")
					{
						string argname =  iter2->first;
						if(iter2->second=="int" || iter2->second=="short" || iter2->second=="double" || iter2->second=="float" || iter2->second=="string"
								|| iter2->second=="bool" || iter2->second=="long" || iter2->second=="long long" || iter2->second=="unsigned int"
									|| iter2->second=="unsigned short" || iter2->second=="unsigned long" || iter2->second=="unsigned long long"
											|| iter2->second=="string")
						{
							ws_funcs.append("ele = _req->getElementByName(\""+argname+"\");\n");
							ws_funcs.append(iter2->second+" "+argname+";\n");
							ws_funcs.append("if(ele.getTagName()!=\"\")");
							ws_funcs.append(argname+" = CastUtil::lexical_cast<"+iter2->second+">(ele.getText());\n");
						}
						else if(iter2->second.find("vector<")!=string::npos)
						{
							string vecn = iter2->second;
							StringUtil::replaceFirst(vecn,"std::"," ");
							StringUtil::replaceFirst(vecn,"vector<"," ");
							StringUtil::replaceFirst(vecn,">"," ");
							StringUtil::trim(vecn);
							if(vecn=="int" || vecn=="short" || vecn=="float" || vecn=="double" || vecn=="bool" || vecn=="long long" || vecn=="long"
									|| vecn=="string" || vecn=="unsigned int" || vecn=="unsigned short" || vecn=="unsigned long long" || vecn=="unsigned long")
							{
								ws_funcs.append("vector<"+vecn+" > "+argname+";\n");
								ws_funcs.append("ElementList list = _req->getElementsByName(\""+argname+"\");\n");
								ws_funcs.append("for(int i=0;i<list.size();i++)");
								ws_funcs.append(argname+".push_back(CastUtil::lexical_cast<"+vecn+">(list.at(i).getText()));\n");
							}
							else
							{
								ws_funcs.append("vector<"+vecn+" > "+argname+";\n");
								ws_funcs.append("ElementList list = _req->getElementsByName(\""+argname+"\");\n");
								ws_funcs.append("for(int i=0;i<list.size();i++)\n{\n");
								ws_funcs.append(argname+".push_back(XMLSerialize::unserialize<vector<"+vecn+" > >(list.at(i).renderSerialization()));\n}\n");
							}
						}
						else
						{
							ws_funcs.append("ele = _req->getElementByName(\""+argname+"\");\n");
							ws_funcs.append(iter2->second+" "+argname+";\n");
							ws_funcs.append("if(ele.getTagName()!=\"\")");
							ws_funcs.append("{\nele.setTagName(\""+iter2->second+"\");");
							//ref.getTreatedFullyQualifiedClassName(argname, )
							ws_funcs.append("\n"+argname+" = XMLSerialize::unserialize<"+iter2->second+">(ele.renderSerialization());\n");
							ws_funcs.append("\ncout << ele.renderSerialization() << endl;");
							ws_funcs.append("}\n");
						}
						args.append(argname);
						if(ter++<pars.size()-2)
							args.append(",");
					}
				}
				ws_funcs.append(ws_n+" _obj;\n");

				//ws_funcs.append("AttributeList attl = _req->getAttributes();\n");
				//ws_funcs.append("AttributeList::iterator it;\n");
				ws_funcs.append("_retStr = \"<tns:\" + _req->getTagName() + \"Response\";\n");
				//ws_funcs.append("for(it=attl.begin();it!=attl.end();it++)\n");
				//ws_funcs.append("_retStr.append(\" \" + it->first + \"=\\\"\" + it->second + \"\\\" \");\n");
				ws_funcs.append("_retStr.append(\">\");\n");
				if(pars["RETURNTYP"]=="void")
				{
					ws_funcs.append("_obj."+me_n+"("+args+");\n");
				}
				else if(pars["RETURNTYP"]=="int" || pars["RETURNTYP"]=="short" || pars["RETURNTYP"]=="float" || pars["RETURNTYP"]=="double"
						|| pars["RETURNTYP"]=="bool" || pars["RETURNTYP"]=="long long" || pars["RETURNTYP"]=="long"
						|| pars["RETURNTYP"]=="unsigned int" || pars["RETURNTYP"]=="unsigned short" || pars["RETURNTYP"]=="string"
						|| pars["RETURNTYP"]=="unsigned long long" || pars["RETURNTYP"]=="unsigned long")
				{
					ws_funcs.append(pars["RETURNTYP"]+" _retval;\n");
					ws_funcs.append("_retval = _obj."+me_n+"("+args+");\n");
					ws_funcs.append("_retStr += \"<tns:"+pars["RETURN"]+">\"+CastUtil::lexical_cast<string>(_retval)+\"</tns:"+pars["RETURN"]+">\";\n");
				}
				else if(pars["RETURNTYP"]!="")
				{
					ws_funcs.append(pars["RETURNTYP"]+" _retval;\n");
					ws_funcs.append("_retval = _obj."+me_n+"("+args+");\n");
					if(pars["RETURNTYP"].find("vector<")!=string::npos)
					{
						string vecn = pars["RETURNTYP"];
						StringUtil::replaceFirst(vecn,"std::"," ");
						StringUtil::replaceFirst(vecn,"vector<"," ");
						StringUtil::replaceFirst(vecn,">"," ");
						StringUtil::trim(vecn);
						if(vecn=="string" || vecn=="int" || vecn=="short" || vecn=="float" || vecn=="double" || vecn=="bool" || vecn=="long long" || vecn=="long"
								|| vecn=="unsigned int" || vecn=="unsigned short" || vecn=="unsigned long long" || vecn=="unsigned long")
						{
							ws_funcs.append("for(int i=0;i<_retval.size();i++)");
							ws_funcs.append("_retStr += \"<tns:"+pars["RETURN"]+">\"+CastUtil::lexical_cast<string>(_retval.at(i))+\"</tns:"+pars["RETURN"]+">\";\n");
						}
						else
						{
							ws_funcs.append("string allnmspcs;\n");
							ws_funcs.append("for(int i=0;i<_retval.size();i++)\n{\n");
							ws_funcs.append("XmlParser parser(\"Parser\");\n");
							ws_funcs.append("allnmspcs = \"\";\n");
							ws_funcs.append("Document doc = parser.getDocument(XMLSerialize::serialize<"+vecn+">(_retval.at(i)));\n");
							ws_funcs.append("\ncout << XMLSerialize::serialize<"+vecn+">(_retval.at(i)) << endl;");
							ws_funcs.append("normalizeNamespaces(doc.getRootElement(),\""+appname+"\",allnmspcs);\n");
							ws_funcs.append("_retStr += \"<tns:"+pars["RETURN"]+">\"+doc.getRootElement().renderChildren()+\"</tns:"+pars["RETURN"]+">\";\n}\n");
						}
					}
					else
					{
						ws_funcs.append("string allnmspcs;\n");
						ws_funcs.append("XmlParser parser(\"Parser\");\n");
						ws_funcs.append("Document doc = parser.getDocument(XMLSerialize::serialize<"+pars["RETURNTYP"]+">(_retval));\n");
						ws_funcs.append("normalizeNamespaces(doc.getRootElement(),\""+appname+"\",allnmspcs);\n");
						ws_funcs.append("_retStr += \"<tns:"+pars["RETURN"]+">\"+doc.getRootElement().renderChildren()+\"</tns:"+pars["RETURN"]+">\";\n");
					}
				}
				ws_funcs.append("_retStr += \"</tns:\" + _req->getTagName() + \"Response>\";\n");
				ws_funcs.append("}catch(const Exception& e){\n");
				ws_funcs.append("return e.getMessage();\n} ");
				ws_funcs.append("catch(const char* e){\n");
				ws_funcs.append("return string(e);\n} ");
				ws_funcs.append("catch(...){\n");
				ws_funcs.append("return \"<soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception occurred</faultstring></soap:Fault>\";\n}\n");
				ws_funcs.append("return _retStr;\n}\n");
			}
			//ws_funcs.append("}\n");
		}
		//AfcUtil::writeTofile(rtdcfp+"WsInterface.cpp",ws_funcs,true);
	}
	return ws_funcs;
}
Esempio n. 12
0
	virtual void ProcessEvent( Event &event )
	{
		if( UI_Main::Get()->debugOn() ) {
			Com_Printf( "EventListener: Event %s, target %s, phase %i\n",
				event.GetType().CString(),
				event.GetTargetElement()->GetTagName().CString(),
				event.GetPhase() );
		}

		if( event.GetType() == "keydown" && 
			( event.GetPhase() == Rocket::Core::Event::PHASE_TARGET || event.GetPhase() == Rocket::Core::Event::PHASE_BUBBLE ) )
		{
			int key = event.GetParameter<int>( "key_identifier", 0 );
			ElementDocument *document = event.GetTargetElement()->GetOwnerDocument();
			WSWUI::Document *ui_document = static_cast<WSWUI::Document *>(document->GetScriptObject());
			WSWUI::NavigationStack *stack = ui_document ? ui_document->getStack() : NULL;

			if( key == Input::KI_ESCAPE ) {
				if( stack ) {
					if( stack->isTopModal() ) {
						// pop the top document
						stack->popDocument();
					}
					else if( stack->getContextId() == UI_CONTEXT_MAIN ) {
						// hide all documents
						UI_Main::Get()->showUI( false );
					}
				}
				event.StopPropagation();
			}
			else if( key == Rocket::Core::Input::KI_BROWSER_BACK || key == Rocket::Core::Input::KI_BACK ) {
				// act as history.back()
				if( stack && stack->hasAtLeastTwoDocuments() ) {
					stack->popDocument();
					event.StopPropagation();
				}
			}
		}
		else if( event.GetType() == "change" && ( event.GetPhase() == Rocket::Core::Event::PHASE_BUBBLE ) ) {
			bool linebreak = event.GetParameter<int>( "linebreak", 0 ) != 0;
			if( linebreak ) {
				// form submission
				String inputType;
				Element *target = event.GetTargetElement();
				Rocket::Controls::ElementFormControl *input = dynamic_cast<Rocket::Controls::ElementFormControl *>(target);

				if( event.GetPhase() != Rocket::Core::Event::PHASE_BUBBLE ) {
					return;
				}
				if( input == NULL ) {
					// not a form control
					return;
				}
				if( input->IsDisabled() ) {
					// skip disabled inputs
					return;
				}
				if( !input->IsSubmitted() ) {
					// this input field isn't submitted with the form
					return;
				}

				inputType = input->GetAttribute<String>( "type", "" );
				if( inputType != "text" && inputType != "password" ) {
					// not a text field
					return;
				}

				// find the parent form element
				Element *parent = target->GetParentNode();
				Rocket::Controls::ElementForm *form = NULL;
				while( parent ) {
					form = dynamic_cast<Rocket::Controls::ElementForm *>(parent);
					if( form != NULL ) {
						// not a form, go up the tree
						break;
					}
					parent = parent->GetParentNode();
				}

				if( form == NULL ) {
					if( UI_Main::Get()->debugOn() ) {
						Com_Printf( "EventListener: input element outside the form, what should I do?\n" );
					}
					return;
				}

				// find the submit element
				Element *submit = NULL;

				ElementList controls;
				parent->GetElementsByTagName( controls, "input" );
				for( size_t i = 0; i < controls.size(); i++ ) {
					Rocket::Controls::ElementFormControl *control =
						dynamic_cast< Rocket::Controls::ElementFormControl* >(controls[i]);

					if( !control ) {
						continue;
					}
					if( control->IsDisabled() ) {
						// skip disabled inputs
						continue;
					}

					String controlType = control->GetAttribute<String>( "type", "" );
					if( controlType != "submit" ) {
						// not a text field
						continue;
					}

					submit = controls[i];
					break;
				}

				if( submit == NULL ) {
					if( UI_Main::Get()->debugOn() ) {
						Com_Printf( "EventListener: form with no submit element, what should I do?\n" );
					}
					return;
				}

				// finally submit the form
				form->Submit( submit->GetAttribute< Rocket::Core::String >("name", ""), submit->GetAttribute< Rocket::Core::String >("value", "") );
			}
		}
	}
Esempio n. 13
0
FFEADContext::FFEADContext(const std::string& depFile, const std::string& appName)
{
	reflector = NULL;
	cleared = false;
	logger = LoggerFactory::getLogger("FFEADContext");
	XmlParser parser("Parser");
	Document doc;
	parser.readDocument(depFile, doc);
	const Element& root = doc.getRootElement();
	ElementList eles = root.getChildElements();
	if(eles.size()>0 && root.getTagName()=="beans")
	{
		for (unsigned int var = 0; var < eles.size(); var++)
		{
			Element* ele = &(eles.at(var));
			if(ele->getTagName()=="bean")
			{
				Bean bean;
				bean.appName = appName;
				bean.name = ele->getAttribute("name");
				bean.value = ele->getAttribute("value");
				bean.inbuilt = ele->getAttribute("inbuilt");
				if(ele->getAttribute("bean")!="")
					throw std::runtime_error("Invalid attribute");
				bean.bean = ele->getAttribute("bean");
				bean.clas = ele->getAttribute("class");
				bean.intfType = ele->getAttribute("intfType");
				bean.injectAs = ele->getAttribute("injectAs");
				bean.scope = ele->getAttribute("scope");
				bean.realbean = true;
				ElementList eleeles = ele->getChildElements();
				if(eleeles.size()==0)
				{

				}
				else
				{
					for (unsigned int var1 = 0; var1 < eleeles.size(); var1++)
					{
						Element* ele1 = &(eleeles.at(var1));
						if(ele1->getTagName()=="inject")
						{
							if(ele1->getAttribute("bean")!="")
							{
								bean.injs.push_back(appName+ele1->getAttribute("bean"));
								if(ele1->getAttribute("name")!="")
									bean.names.push_back(appName+ele1->getAttribute("name"));
								else
									bean.names.push_back(appName+ele1->getAttribute("bean"));
								bean.types.push_back(ele1->getAttribute("intfType"));
							}
							else
							{
								Bean beanc;
								beanc.appName = appName;
								beanc.name = ele1->getAttribute("name");
								beanc.value = ele1->getAttribute("value");
								beanc.inbuilt = ele1->getAttribute("inbuilt");
								beanc.clas = ele1->getAttribute("class");
								beanc.intfType = ele1->getAttribute("intfType");
								bean.scope = ele1->getAttribute("scope");
								beanc.realbean = false;
								injbns[beanc.appName+beanc.name] = beanc;
								bean.injs.push_back(beanc.appName+beanc.name);
								bean.names.push_back(beanc.appName+beanc.name);
							}
						}
						else
						{
							throw std::runtime_error("Invalid tag");
						}
					}
				}
				beans[bean.appName+bean.name] = bean;
			}
			else
			{
				throw std::runtime_error("Invalid tag");
			}
		}
	}
}
Esempio n. 14
0
void* MethodInvoc::service(void* arg)
{
	int fd = *(int*)arg;
	init();
	string methInfo,retValue;
	_methinv_instance->server.Receive(fd,methInfo,1024);
	methInfo =methInfo.substr(0,methInfo.find_last_of(">")+1);
	try
	{
		XmlParser parser("Parser");
		if(methInfo.find("lang=\"c++\"")!=string::npos || methInfo.find("lang='c++'")!=string::npos)
		{
			Document doc = parser.getDocument(methInfo);
			Element message = doc.getRootElement();
			if(message.getTagName()!="method")
			{
				throw MethodInvokerException("No method Tag\n",retValue);
			}
			if(message.getAttributes().size()<3)
			{
				throw MethodInvokerException("name,class and lang are mandatory attributes\n",retValue);
			}
			else if(message.getAttribute("name")=="")
			{
				throw MethodInvokerException("name attribute missing\n",retValue);
			}
			else if(message.getAttribute("className")=="")
			{
				throw MethodInvokerException("class attribute missing\n",retValue);
			}
			else if(message.getAttribute("lang")=="")
			{
				throw MethodInvokerException("lang attribute missing\n",retValue);
			}
			if(message.getChildElements().size()!=1)
			{
				throw MethodInvokerException("message tag should have only one child tag\n",retValue);
			}
			else if(message.getChildElements().at(0).getTagName()!="args")
			{
				throw MethodInvokerException("message tag should have an args child tag\n",retValue);
			}
			XMLSerialize ser;
			Reflector reflector;
			args argus;
			vals valus;
			ElementList argts = message.getChildElements().at(0).getChildElements();
			for (unsigned var = 0; var < argts.size();  var++)
			{
				void *value = NULL;
				Element arg = argts.at(var);
				if(arg.getTagName()!="argument" || arg.getAttribute("type")=="")
					throw MethodInvokerException("every argument tag should have a name and type attribute\n",retValue);
				if(arg.getText()=="" && arg.getChildElements().size()==0)
					throw MethodInvokerException("argument value missing\n",retValue);
				if(arg.getAttribute("type")=="int")
				{
					int *vt = new int;
					*vt = CastUtil::lexical_cast<int>(arg.getText());
					value = vt;
				}
				else if(arg.getAttribute("type")=="float")
				{
					float *vt = new float;
					*vt = CastUtil::lexical_cast<float>(arg.getText());
					value = vt;
				}
				else if(arg.getAttribute("type")=="double")
				{
					double *vt = new double;
					*vt = CastUtil::lexical_cast<double>(arg.getText());
					value = vt;
				}
				else if(arg.getAttribute("type")=="string")
				{
					string *vt = new string;
					*vt = CastUtil::lexical_cast<string>(arg.getText());
					value = vt;
				}
				else if(arg.getAttribute("type")!="")
				{
					Element obj = arg.getChildElements().at(0);
					string objxml = obj.render();
					string objClassName = obj.getTagName();
					value = ser.unSerializeUnknown(objxml,arg.getAttribute("type"));
				}
				argus.push_back(arg.getAttribute("type"));
				valus.push_back(value);
			}
			string className = message.getAttribute("className");
			string returnType = message.getAttribute("returnType");
			string lang = message.getAttribute("lang");
			ClassInfo clas = reflector.getClassInfo(className);
			string methodName = message.getAttribute("name");;
			if(clas.getClassName()=="")
			{
				throw MethodInvokerException("class does not exist or is not in the library path\n",retValue);
			}
			Method meth = clas.getMethod(methodName,argus);
			if(meth.getMethodName()=="")
			{
				throw MethodInvokerException("method does not exist for the class or the class does not exist in the library path\n",retValue);
			}
			else
			{
				args argus;
				Constructor ctor = clas.getConstructor(argus);
				void *_temp = reflector.newInstanceGVP(ctor);
				if(returnType=="void" || returnType=="")
				{
					reflector.invokeMethod<void*>(_temp,meth,valus);
					retValue = ("<return:void></return:void>");
				}
				else
				{
					if(returnType=="int")
					{
						int retv = reflector.invokeMethod<int>(_temp,meth,valus);
						retValue = ("<return:int>"+CastUtil::lexical_cast<string>(retv)+"</return:int>");
					}
					else if(returnType=="float")
					{
						float retv = reflector.invokeMethod<float>(_temp,meth,valus);
						retValue = ("<return:float>"+CastUtil::lexical_cast<string>(retv)+"</return:float>");
					}
					else if(returnType=="double")
					{
						double retv = reflector.invokeMethod<double>(_temp,meth,valus);
						retValue = ("<return:double>"+CastUtil::lexical_cast<string>(retv)+"</return:double>");
					}
					else if(returnType=="string")
					{
						string retv = reflector.invokeMethod<string>(_temp,meth,valus);
						retValue = ("<return:string>"+retv+"</return:string>");
					}
					else if(returnType!="")
					{
						void* retobj = reflector.invokeMethodUnknownReturn(_temp,meth,valus);
						string oxml = ser.serializeUnknown(retobj,returnType);
						retValue = ("<return:"+returnType+">"+oxml+"</return:"+returnType+">");
					}
				}

			}
		}
		else
		{
			retValue = "<return:exception>This is a C++ daemon</return:exception>";
		}
		if(retValue!="")
			_methinv_instance->server.Send(fd,retValue);
		close(fd);
	}
	catch(MethodInvokerException *e)
	{
		_methinv_instance->server.Send(fd,retValue);
		close(fd);
	}
	catch(...)
	{
		retValue = ("<return:exception>XmlParseException occurred</return:exception>");
		_methinv_instance->server.Send(fd,retValue);
		close(fd);
	}
	return NULL;
}