<!--

function doProcess(appName,serviceName,xmlData,request,isSyn){
	if(isSyn){
		isSyn = true;
	}else{
		isSyn = false;
	}
	var xmlhttp = false;
	if(!request){
		xmlhttp = getXmlHttpRequest();
	}else{
		xmlhttp = request;
	}
	xmlhttp.open("POST", PortalConstants.PORTAL_CONTEXT + "/SOA?AppName="+appName+"&Service="+serviceName+"",isSyn);
	xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=UTF-8");
	xmlhttp.send(xmlData);
}

//处理actionURL或renderURL的请求
function doURLProcess(appName,serviceName,param,xmlData,request,isSyn){
	if(isSyn){
		isSyn = true;
	}else{
		isSyn = false;
	}
	var xmlhttp = false;
	if(request){
		xmlhttp = request;
	}else{
		xmlhttp = getXmlHttpRequest();
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4){
				if(xmlhttp.status == 200){
					if(xmlhttp.responseText){
						window.location.reload();
					}
				}
			}
		};
	}

	xmlhttp.open("POST",PortalConstants.PORTAL_CONTEXT + "/SOA?AppName="+appName+"&Service="+serviceName+"&" + param,isSyn);
	xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=UTF-8");
	xmlhttp.send(xmlData);
	
}

function getXmlHttpRequest(){
	var xmlhttp = false;
	try{
		if(window.XMLHttpRequest){
			xmlhttp =  new XMLHttpRequest(); 
		}else if (window.ActiveXObject) {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
	}catch(e){
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (e) {
			try {
				xmlhttp = new XMLHttpRequest();
			}catch (e) {
			}
		}
	}
	
	return xmlhttp;
}

function RequestHandler(){
	this.xmlHttpRequest = getXmlHttpRequest();
	this.param = "";
	this.isAsyn = "true";
	this.serviceName = "";
	this.sendStr = "";
	this.serviceChannel = "";
	
	this.setServiceChannel = function(serviceChannel){
		this.serviceChannel = serviceChannel;
	};
	
	this.setParam = function(key,value){
		this.param += key + "=" + value + "&"	
	};
	this.setStateChange = function(funcName){
		var request = this.xmlHttpRequest;
		this.xmlHttpRequest.onreadystatechange = function(){
		 	funcName(request);
		 };
	}
	this.setSynchronous = function(){
		this.isAsyn = false;
	}
	this.setServiceName = function(serviceName){
		this.serviceName = serviceName;
	}
	
	this.setSendString = function(sendStr){
		this.sendStr = sendStr;
	}
	
	this.setInstanceId = function(instanceId){
		if(instanceId){
			this.param += "instanceId=" + instanceId + "&"
		}
	}
	
	this.sendRequest = function(){
		if(!this.serviceChannel){
			alert("尚未设置处理请求的服务通道，请求失败！");
			return;
		}
		if(!this.serviceName){
			alert("尚未设置处理请求的服务名称，请求失败！");
			return;
		}
		if(this.param){
		    //this.param = this.param.substring(0,this.param.length-2);
            this.param = this.param.substring(0,this.param.length-1);
			doURLProcess(this.serviceChannel,this.serviceName,this.param,this.sendStr,this.xmlHttpRequest,this.isAsyn);
		}else{
			doProcess(this.serviceChannel,this.serviceName,this.sendStr,this.xmlHttpRequest,this.isAsyn);
			
		}
	}
}

-->