Accepts any ExternalMethod stores any modification query locally if transaction is in progress (and returns temporary result)
        prepares xml query as per the writeXmlOption from external method. Opens a connection to url, sends the xmlQuery string to url 
        location, and returns result. Prepares objects from xml query result and returns external method response.

def XmlQuery(self, method, options, dumpXml=None):
		"""
        Accepts any ExternalMethod stores any modification query locally if transaction is in progress (and returns temporary result)
        prepares xml query as per the writeXmlOption from external method. Opens a connection to url, sends the xmlQuery string to url 
        location, and returns result. Prepares objects from xml query result and returns external method response.
        """
		from UcsBase import ExternalMethod, ManagedObject, UcsUtils
		from Ucs import ConfigConfig, Pair, ConfigMap
		from MoMeta import _ManagedObjectMeta
		from MethodMeta import _MethodFactoryMeta

		if ((self._transactionInProgress == True) and (
					method.propMoMeta.xmlAttribute in [NamingId.CONFIG_CONF_MO, NamingId.CONFIG_CONF_MOS])):
			if (method.propMoMeta.xmlAttribute == NamingId.CONFIG_CONF_MO):
				ccm = method
				ccmResponse = ExternalMethod(NamingId.CONFIG_CONF_MO)
				ccmResponse.setattr("Dn", ccm.Dn)
				ccmResponse.InConfig = ConfigConfig()

				pair = Pair()
				pair.Key = ccm.Dn
				for mo in ccm.InConfig.GetChild():
					if (isinstance(mo, ManagedObject) == True):
						pair.AddChild(mo.Clone())

						clone = mo.Clone()
						clone.MarkClean()
						clone.SetHandle(self)

						ccmResponse.InConfig.AddChild(clone)
				self._configMap.AddChild(pair)

				ccmResponse.setattr("OutConfig", ccmResponse.getattr("InConfig"))
				ccmResponse.setattr("InConfig", None)
				ccmResponse.response = "yes"
				return ccmResponse
			else:
				ccm = method
				ccmResponse = ExternalMethod(NamingId.CONFIG_CONF_MOS)
				ccmResponse.InConfigs = ConfigMap()

				for pair in ccm.InConfigs.GetChild():
					if (isinstance(pair, Pair) == True):
						self._configMap.AddChild(pair.Clone())
						clone = pair.Clone()
						for mo in clone.GetChild():
							if (isinstance(mo, ManagedObject) == True):
								mo.MarkClean()
								mo.SetHandle(self)
						ccmResponse.InConfigs.AddChild(clone)
				ccmResponse.setattr("OutConfigs", ccmResponse.getattr("InConfigs"))
				ccmResponse.setattr("InConfigs", None)
				ccmResponse.response = "yes"
				return ccmResponse
		else:
			try:
				if (dumpXml == None):
					dumpXml = self._dumpXml

				w = xml.dom.minidom.Document()
				w.appendChild(method.WriteXml(w, options))
				uri = self.Uri() + '/nuova'
				if (dumpXml in _AffirmativeList):
					print '%s ====> %s' % (self._ucs, w.toxml())

				if (self._proxy is None):
					if (self._noSsl):
						req = urllib2.Request(url=uri, data=w.toxml())
						opener = urllib2.build_opener(SmartRedirectHandler())
						f = opener.open(req)
						# print "##", f , "##"

						if type(f) is list:
							if (len(f) == 2 and f[0] == 302):
								# self._noSsl = False
								# uri = self.Uri() + '/nuova'
								uri = f[1]
								req = urllib2.Request(url=uri, data=w.toxml())
								f = urllib2.urlopen(req)
							# print "status code is:",f[0]
							# print "location is:", f[1]
					else:
						req = urllib2.Request(url=uri, data=w.toxml())
						opener = urllib2.build_opener()
						f = opener.open(req)
					# f = urllib2.urlopen(req)
				else:

					proxy_handler = urllib2.ProxyHandler({'http': self._proxy, 'https': self._proxy})

					if (self._noSsl):
						req = urllib2.Request(url=uri, data=w.toxml())
						opener = urllib2.build_opener(proxy_handler, SmartRedirectHandler())
						f = opener.open(req)

						if type(f) is list:
							if (len(f) == 2 and f[0] == 302):
								# self._noSsl = False
								# uri = self.Uri() + '/nuova'
								uri = f[1]
								req = urllib2.Request(url=uri, data=w.toxml())
								opener = urllib2.build_opener(proxy_handler)
								f = opener.open(req)
							# f = urllib2.urlopen(req)
							# print "status code is:",f[0]
							# print "location is:", f[1]
					else:
						req = urllib2.Request(url=uri, data=w.toxml())
						opener = urllib2.build_opener(proxy_handler)
						f = opener.open(req)

				rsp = f.read()
				if (dumpXml in _AffirmativeList):
					print '%s <==== %s' % (self._ucs, rsp)

				# method = method.propMoMeta.name
				response = ExternalMethod(method.propMoMeta.name)
				doc = parseString(rsp)
				response.LoadFromXml(doc.childNodes[0], self)
				return response
			# For catching URLError and returning string representation of URLError class as there is no
			# message attribute in this class.
			#			except urllib2.URLError, e:
			#				response = ExternalMethod(method.propMoMeta.name)
			#				response.getErrorResponse("300",str(e))
			#				return response
			#			#For catching HTTPError and returning msg attribute of this class.
			#			except urllib2.HTTPError, e:
			#				response = ExternalMethod(method.propMoMeta.name)
			#				response.getErrorResponse(e.code,e.msg)
			#				return response
			#			#Wide Catch block for catching all type of exception objects.
			#			except Exception, e:
			#				response = ExternalMethod( method.propMoMeta.name)
			#				response.getErrorResponse("300",e.message)
			#				return response
			except Exception, e:
				raise