# Path: webui/server/tornadows/soap.py
# class SoapMessage:
# 	def __init__(self):
# 	def getSoap(self):
# 	def getHeader(self):
# 	def getBody(self):
# 	def setHeader(self, header):
# 	def setBody(self,body):
# 	def removeHeader(self):
# 	def removeBody(self):
# 
# Path: webui/server/tornadows/xmltypes.py
# def createElementXML(name,type,prefix='xsd'):
# def createArrayXML(name,type,prefix='xsd',maxoccurs=None):
# 	def __init__(self,type,maxOccurs=None):
# 	def createArray(self,name):
# 	def createType(self,name):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# class Array:
# class PrimitiveType:
# class Integer(PrimitiveType):
# class Decimal(PrimitiveType):
# class Double(PrimitiveType):
# class Float(PrimitiveType):
# class Duration(PrimitiveType):
# class Date(PrimitiveType):
# class Time(PrimitiveType):
# class DateTime(PrimitiveType):
# class String(PrimitiveType):
# class Boolean(PrimitiveType):
# 
# Path: webui/server/tornadows/complextypes.py
# class Property:
# class IntegerProperty(Property):
# class DecimalProperty(Property):
# class DoubleProperty(Property):
# class FloatProperty(Property):
# class DurationProperty(Property):
# class DateProperty(Property):
# class TimeProperty(Property):
# class DateTimeProperty(Property):
# class StringProperty(Property):
# class BooleanProperty(Property):
# class ArrayProperty(list):
# class ComplexType(object):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self, object, minOccurs = 1, maxOccurs=None, data=[]):
# 	def toXSD(self,namespace='xsd',nameelement=None):
# 	def __init__(self):
# 	def toXML(self,name=None,method=''):
# 	def toXSD(cls,xmlns='http://www.w3.org/2001/XMLSchema',namespace='xsd',method='', ltype=[]):
# 	def _generateXSD(cls,xmlns='http://www.w3.org/2001/XMLSchema',namespace='xsd', ltype=[]):
# 	def getName(cls):
# 	def _createAttributeType(self,element):
# def xml2object(xml,xsd,complex,method=''):
# def cls2dict(complex):
# def xsd2dict(xsd,namespace='xsd'):
# def xml2list(xmldoc,name,types,method=''):
# def generateOBJ(d,namecls,types):
# def createProperty(typ,value):
# def genattr(elems):
# def findElementFromDict(dictionary,key):
# def convert(typeelement,value):
# def createPythonType2XMLType(pyType):
# 
# Path: webui/server/tornadows/wsdl.py
# class Wsdl:
# 	def __init__(self,nameservice=None,targetNamespace=None,methods=None,location=None):
# 	def createWsdl(self):
# 	def _createTypes(self, name, elements):
# 	def _createComplexTypes(self, name, arguments, elements):


import tornado.httpserver
import tornado.web
import xml.dom.minidom
import inspect
from tornado.options import options
from webui.server.tornadows import soap
from webui.server.tornadows import xmltypes
from webui.server.tornadows import complextypes
from webui.server.tornadows import wsdl
		    this method return a list values of parameters.
		 """
		values   = []
		for tagname in args:
			type = types[tagname]
			values += self._findValues(tagname,type,elements)
		return values		

	def _findValues(self,name,type,xml):
		""" Private method to find the values of elements in the XML of input """
		elems = xml.getElementsByTagName(name)
		values = []
		for e in elems:
			if e.hasChildNodes and len(e.childNodes) > 0:
				v = None
				if inspect.isclass(type) and (issubclass(type,xmltypes.PrimitiveType) or isinstance(type,xmltypes.Array)):
					v = type.genType(e.childNodes[0].nodeValue)
				elif hasattr(type,'__name__') and (not issubclass(type,xmltypes.PrimitiveType) or not isinstance(type,xmltypes.Array)):
					v = complextypes.convert(type.__name__,e.childNodes[0].nodeValue)
				values.append(v)
			else:
				values.append(None)
		return values

	def _createReturnsComplexType(self,result,method=''):
		""" Private method to generate the xml document with the response. 
		    Return an SoapMessage() with XML document.
		"""
		response = xml.dom.minidom.parseString(result.toXML(method=method))
		

# Path: webui/server/tornadows/soap.py
# class SoapMessage:
# 	def __init__(self):
# 	def getSoap(self):
# 	def getHeader(self):
# 	def getBody(self):
# 	def setHeader(self, header):
# 	def setBody(self,body):
# 	def removeHeader(self):
# 	def removeBody(self):
# 
# Path: webui/server/tornadows/xmltypes.py
# def createElementXML(name,type,prefix='xsd'):
# def createArrayXML(name,type,prefix='xsd',maxoccurs=None):
# 	def __init__(self,type,maxOccurs=None):
# 	def createArray(self,name):
# 	def createType(self,name):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# 	def createElement(name,prefix='xsd'):
# 	def getType(self):
# 	def genType(self,v):
# class Array:
# class PrimitiveType:
# class Integer(PrimitiveType):
# class Decimal(PrimitiveType):
# class Double(PrimitiveType):
# class Float(PrimitiveType):
# class Duration(PrimitiveType):
# class Date(PrimitiveType):
# class Time(PrimitiveType):
# class DateTime(PrimitiveType):
# class String(PrimitiveType):
# class Boolean(PrimitiveType):
# 
# Path: webui/server/tornadows/complextypes.py
# class Property:
# class IntegerProperty(Property):
# class DecimalProperty(Property):
# class DoubleProperty(Property):
# class FloatProperty(Property):
# class DurationProperty(Property):
# class DateProperty(Property):
# class TimeProperty(Property):
# class DateTimeProperty(Property):
# class StringProperty(Property):
# class BooleanProperty(Property):
# class ArrayProperty(list):
# class ComplexType(object):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self):
# 	def __init__(self, object, minOccurs = 1, maxOccurs=None, data=[]):
# 	def toXSD(self,namespace='xsd',nameelement=None):
# 	def __init__(self):
# 	def toXML(self,name=None,method=''):
# 	def toXSD(cls,xmlns='http://www.w3.org/2001/XMLSchema',namespace='xsd',method='', ltype=[]):
# 	def _generateXSD(cls,xmlns='http://www.w3.org/2001/XMLSchema',namespace='xsd', ltype=[]):
# 	def getName(cls):
# 	def _createAttributeType(self,element):
# def xml2object(xml,xsd,complex,method=''):
# def cls2dict(complex):
# def xsd2dict(xsd,namespace='xsd'):
# def xml2list(xmldoc,name,types,method=''):
# def generateOBJ(d,namecls,types):
# def createProperty(typ,value):
# def genattr(elems):
# def findElementFromDict(dictionary,key):
# def convert(typeelement,value):
# def createPythonType2XMLType(pyType):
# 
# Path: webui/server/tornadows/wsdl.py
# class Wsdl:
# 	def __init__(self,nameservice=None,targetNamespace=None,methods=None,location=None):
# 	def createWsdl(self):
# 	def _createTypes(self, name, elements):
# 	def _createComplexTypes(self, name, arguments, elements):


# Path: webui/server/tornadows/soaphandler.py
import tornado.httpserver
import tornado.web
import xml.dom.minidom
import inspect
from tornado.options import options
from webui.server.tornadows import soap
from webui.server.tornadows import xmltypes
from webui.server.tornadows import complextypes
from webui.server.tornadows import wsdl

		    this method return a list values of parameters.
		 """
		values   = []
		for tagname in args:
			type = types[tagname]
			values += self._findValues(tagname,type,elements)
		return values		

	def _findValues(self,name,type,xml):
		""" Private method to find the values of elements in the XML of input """
		elems = xml.getElementsByTagName(name)
		values = []
		for e in elems:
			if e.hasChildNodes and len(e.childNodes) > 0:
				v = None
				if inspect.isclass(type) and (issubclass(type,xmltypes.PrimitiveType) or isinstance(type,xmltypes.Array)):
					v = type.genType(e.childNodes[0].nodeValue)
				elif hasattr(type,'__name__') and (not issubclass(type,xmltypes.PrimitiveType) or not isinstance(type,xmltypes.Array)):
					v = complextypes.convert(type.__name__,e.childNodes[0].nodeValue)
				values.append(v)
			else:
				values.append(None)
		return values

	def _createReturnsComplexType(self,result,method=''):
		""" Private method to generate the xml document with the response. 
		    Return an SoapMessage() with XML document.
		"""
		response = xml.dom.minidom.parseString(result.toXML(method=method))
		

		soapResponse = soap.SoapMessage()