Ejemplo n.º 1
0
def tryHTTPServer():
    import sys
    from SOAPpy import SOAPProxy

    # Start Server: python hicloud.core/http.py -s
    if len(sys.argv) == 2 and sys.argv[1] == '-s':
        listen_port = ('172.20.0.235', 8080)
        server = MixedHTTPServer(listen_port, '')

        class Test1:
            def func1(self):
                return 'Test1 func1'

        class Test2:
            def func2(self):
                return 'Test2 func2'

            def func1(self):
                return 'Test2 func1'

        server.register_soap_module(Test1(), path='test1')
        server.register_soap_module(Test2(), path='test2')
        server.register_soap_module(tryServerclass(), path='tryServerclass')
        server.serve_loop()

    # Run Client: python hicloud.core/http.py
    else:
        proxy = SOAPProxy("http://localhost:8080/test2")
        logger.info(proxy.func1())  # Test2 func1
        logger.info(proxy.func2())  # Test2 func2
        proxy = SOAPProxy("http://localhost:8080/test1")
        logger.info(proxy.func1())  # Test1 func1

        # this call should fail
        logger.info(proxy.func2())
Ejemplo n.º 2
0
    def _get_test_case_indication(self):
        """
        Display the test case indication
        """
        soap_response = SOAPProxy(self._prj_explorer_service,
                                  throw_faults=0).doCheckTestCaseStatus()

        if "faultstring" in soap_response:
            raise TestEquipmentException(
                TestEquipmentException.OPERATION_FAILED,
                "Fail to get test case indication ! - %s" % soap_response)

        tc_indication_number = int(
            soap_response._asdict().get('AVAIL_TC_INDS'))
        indication_msg = ""

        for _i in range(tc_indication_number):
            soap_response = SOAPProxy(self._prj_explorer_service,
                                      throw_faults=0).doGetNextTCIndication()
            if "faultstring" not in soap_response:
                tc_indication = soap_response._asdict()
                if 'MESSAGE' in tc_indication.keys():
                    # Format str by removing all strip spaces, \n
                    tc_indication = tc_indication.get('MESSAGE').strip()
                    tc_indication = tc_indication.replace('\n', '')

                    # Update the full indication message
                    indication_msg += tc_indication
                    indication_msg += '\n'

        if indication_msg != "":
            self._logger.info("\n" + str(indication_msg))
Ejemplo n.º 3
0
 def __init__(self, url, user=None, passwd=None):
     if user is None:
         self.server = SOAPProxy(url)
     else:
         self.server = SOAPProxy(url,
                                 transport=HTTPHeaderTransport,
                                 namespace=self.namespace)
         self.server.transport.headers = {
             'Username': user,
             'Password': passwd
         }
Ejemplo n.º 4
0
def textToSpeech2(name, passwd, xlatText):
    server = SOAPProxy(url, namespace)
    server.config.debug = 0
    reqStatus = server.ConvertSimple(name, passwd, xlatText)
    print "request status = ", reqStatus
    retResult = reqStatus.split('&')
    print "request result = ", retResult

    if int(retResult[0]) == 0:
        # check convert progress
        cvtResult = ['0'] * 5
        #statusCode = '0'
        while int(cvtResult[2]) in {0, 1}:  # wait completion
            cvtStatus = server.GetConvertStatus(name, passwd,
                                                int(retResult[2]))
            print "convert status = ", cvtStatus, "ID", retResult[2]
            # on success, status is return URL
            #resultCode, resultString, statusCode, status = cvtStatus.split('&')
            cvtResult = cvtStatus.split('&')
            print cvtResult
            sleep(0.5)

        # save to file
        if (int(cvtResult[2]) == 2):  # '2' means "completed"
            waveUrl = cvtResult[4]
            req = urllib2.Request(waveUrl)
            resp = urllib2.urlopen(req)
            wavFile = resp.read()
            outfile = open(xlatText + u".wav", 'wb')
            outfile.write(wavFile)
    else:
        return retResult[1]
Ejemplo n.º 5
0
def getActiveStationsSoappy(debug=False):
    '''
    Use the old SOAPpy interface to get the stations

    Here is the results for one station:

    print response.station[1]

    <SOAPpy.Types.structType station at 20681072>: {'parameter': ['', ''], 'metadata': <SOAPpy.Types.structType metadata at 20683272>: {'date_established': '1954-11-24', 'location': <SOAPpy.Types.structType location at 20635240>: {'lat': '21 57.3 N', 'state': 'HI', 'long': '159 21.4 W'}}}



    >>> response = getActiveStationsSoappy()
    >>> str(response.station[1].metadata.location.lat)
    '21 57.3 N'
    >>> str(response.station[1].metadata.location.long)
    '159 21.4 W'
    >>> str(response.station[1].metadata.location.state)
    'HI'

    @param debug: set to true to see more information about the transaction
    @return: a large typestring
    '''
    from SOAPpy import SOAPProxy
    url = 'http://opendap.co-ops.nos.noaa.gov/axis/services/ActiveStations'
    namespace = 'urn:ActiveStations'  # This really can be anything.  It is ignored
    server = SOAPProxy(url, namespace)
    if debug: server.config.debug = 1
    response = server.getActiveStations()
    return response
Ejemplo n.º 6
0
 def setupSoapProxy(self, soapurl, namespace):
     self.soapServiceUrl = soapurl
     self.soapServiceNamespace = namespace
     self.soapServiceProxy = SOAPProxy(soapurl, namespace)
     self.soapResultUnwrappingOff()
     self.soapObjectSimplifyingOff()
     return self.soapServiceProxy
Ejemplo n.º 7
0
def Devicelist(params):
    #returns a list of firewalls
    SessionID = params['SessionID']
    device_list = []
    device_infor = []
    proxy = 'https://' + sHost + '/AFA/php/ws.php?wsdl'
    namespace = 'https://www.algosec.com/afa-ws'
    server = SOAPProxy(proxy, namespace)
    devices = server.GetDevicesListRequest(
        SessionID=SessionID)  #this makes the call to algosec
    devices = str(devices)
    devices = devices.replace("-", "_")  #cleans the data
    devices = devices.split(',')
    for device in devices:
        if "structType" in device:
            device_list.append(device_infor)
            device_infor = []
        else:
            replacement_list = ["'", "}", "{", " "]  #clean the data
            for x in replacement_list:
                device = device.replace(x, "")
            device = device.split(":")
            device_infor.append(device)

    print device_list
    return device_list
Ejemplo n.º 8
0
    def __init__(self, irc):
        self.__parent = super(Mantis, self)
        self.__parent.__init__(irc)

        self.saidBugs = ircutils.IrcDict()
        sayTimeout = self.registryValue('bugSnarferTimeout')
        for k in irc.state.channels.keys():
            self.saidBugs[k] = TimeoutQueue(sayTimeout)

        self.urlbase = self.registryValue('urlbase')
        self.privateurlbase = self.registryValue('privateurlbase')

        if self.privateurlbase != "":
            serviceUrl = self.privateurlbase + '/api/soap/mantisconnect.php'
        else:
            serviceUrl = self.urlbase + '/api/soap/mantisconnect.php'

        self.server = SOAPProxy(serviceUrl)._ns(namespace)
        self.username = self.registryValue('username')
        self.password = self.registryValue('password')
        self.oldperiodic = self.registryValue('bugPeriodicCheck')
        self.irc = irc
        self.lastBug = 0

        bugPeriodicCheck = self.oldperiodic
        if bugPeriodicCheck > 0:
            schedule.addPeriodicEvent(self._bugPeriodicCheck,
                                      bugPeriodicCheck,
                                      name=self.name())

        reload(sys)
        sys.setdefaultencoding('utf-8')
Ejemplo n.º 9
0
def getWaterLevelSoappyNow(stationId,debug=False):
    '''
    Use OLD SOAPpy interface to get the waterlevel for a station
    '''

    d = datetime.datetime.utcnow()

    print 'FIX: do this in seconds space!!!!  This is crap!'

    startD = d + datetime.timedelta(minutes=-20)
    endD = d + datetime.timedelta(minutes=10)
    #startMin = int(d.minute) - 6
    #endMin = int(d.minute) + 1
    print startD,endD,d

    beginDate = str(startD.year)+('%02d' % startD.month)+('%02d' % startD.day)+' '+ ('%02d' % (startD.hour))+':'+('%02d' % (startD.minute))
    endDate = str(endD.year)+('%02d' % endD.month)+('%02d' % endD.day)+' '+ ('%02d' % (endD.hour))+':'+('%02d' % (endD.minute))
    #print beginDate,endDate

    from SOAPpy import SOAPProxy
    url = 'http://opendap.co-ops.nos.noaa.gov/axis/services/WaterLevelRawSixMin'
    namespace='urn:WaterLevelRawSixMin' # This really can be anything.  It is ignored
    server = SOAPProxy(url,namespace)
    if debug: server.config.debug=1
    #response = server.getWaterLevelRawSixMin(stationId=str(stationId),beginDate='20051201 00:00',endDate='20051201 00:18',datum='MLLW',unit=0,timeZone=0)


    response = server.getWaterLevelRawSixMin(stationId=str(stationId),beginDate=beginDate,endDate=endDate,datum='MLLW',unit=0,timeZone=0)
    # only return the last entry
    return response.item[-1]
Ejemplo n.º 10
0
 def _get_send_status(self, track_id, signature_d, token):
     url = server_url[
         self.company_id.dte_service_provider] + 'QueryEstUp.jws?WSDL'
     ns = 'urn:' + server_url[
         self.company_id.dte_service_provider] + 'QueryEstUp.jws'
     _server = SOAPProxy(url, ns)
     rut = self.format_vat(self.company_id.vat)
     respuesta = _server.getEstUp(rut[:8], str(rut[-1]), track_id, token)
     self.sii_message = respuesta
     resp = xmltodict.parse(respuesta)
     status = False
     if resp['SII:RESPUESTA']['SII:RESP_HDR']['ESTADO'] == "-11":
         status = {
             'warning': {
                 'title':
                 _('Error -11'),
                 'message':
                 _("Error -11: Espere a que sea aceptado por el SII, intente en 5s más"
                   )
             }
         }
     if resp['SII:RESPUESTA']['SII:RESP_HDR']['ESTADO'] == "EPR":
         self.state = "Proceso"
         if resp['SII:RESPUESTA']['SII:RESP_BODY']['RECHAZADOS'] == "1":
             self.sii_result = "Rechazado"
     elif resp['SII:RESPUESTA']['SII:RESP_HDR']['ESTADO'] == "RCT":
         self.state = "Rechazado"
         status = {
             'warning': {
                 'title': _('Error RCT'),
                 'message': _(resp['SII:RESPUESTA']['GLOSA'])
             }
         }
     return status
Ejemplo n.º 11
0
 def _get_cesion_dte_status(self, signature_d, token):
     url = server_url[
         self.company_id.
         dte_service_provider] + 'services/wsRPETCConsulta?wsdl'
     ns = 'urn:' + server_url[
         self.company_id.dte_service_provider] + 'services/wsRPETCConsulta'
     _server = SOAPProxy(url, ns)
     rut = signature_d['subject_serial_number']
     respuesta = _server.getEstCesion(
         token,
         rut[:8],
         str(rut[-1]),
         str(self.sii_document_class_id.sii_code),
         str(self.sii_document_number),
     )
     self.sii_cesion_message = respuesta
     resp = xmltodict.parse(respuesta)
     sii_result = 'Procesado'
     status = False
     if resp['SII:RESPUESTA']['SII:RESP_HDR']['SII:ESTADO'] in ['2', '-13']:
         status = {
             'warning': {
                 'title':
                 _("Error code: 2"),
                 'message':
                 _(resp['SII:RESPUESTA']['SII:RESP_HDR']['SII:GLOSA'])
             }
         }
         sii_result = "Rechazado"
     if resp['SII:RESPUESTA']['SII:RESP_HDR']['SII:ESTADO'] == "0":
         sii_result = "Cedido"
     elif resp['SII:RESPUESTA']['SII:RESP_HDR']['SII:ESTADO'] == "FAU":
         sii_result = "Rechazado"
     self.sii_cesion_result = sii_result
     return status
Ejemplo n.º 12
0
def deleteFabricante(codigoFabricante):
    try:

        servico = SOAPProxy("http://localhost:8083")
        produtos = servico.listarProduto()

        existe = False

        for linha in linhas:
            codigo, descricao, preco, codigoFabricante_ = linha.split('|')
            if codigoFabricante == codigoFabricante_:
                existe = True

        if existe is False:

            f = open(db, "r")
            linhas = f.readlines()
            f.close()

            f = open(db, "w")
            for linha in linhas:
                codigo, descricao, localizacao = linha.split('|')
                if codigo != codigoFabricante:
                    f.write(linha)
            f.close()

            return True
    except:
        return False
Ejemplo n.º 13
0
def deletarVenda(codigo_venda):
    service = SOAPProxy("http://localhost:8009")
    try:
        lines = open(db, "r").readlines()
        existe = False
        for line in lines:
            codigo_venda, codigo_cliente, codigo_funcionario, data, valor_total, codigo_produto, quantidade = line.split(
                '|')
            if codigo_venda == codigo_venda:
                existe = True
        if existe:
            v = open(db, "r")
            lines = v.readlines()
            v.close()

            v = open(db, "w")
            for line in lines:
                codigo_venda, codigo_cliente, codigo_funcionario, data, valor_total, codigo_produto, quantidade = line.split(
                    '|')
                if codigo_venda != codigo_venda:
                    v.write(line)
            v.close()
            return True
    except:
        return False
Ejemplo n.º 14
0
def createincident(params_dict):

    # instance to send to
    instance = 'demo'

    # username/password
    username = '******'
    password = '******'

    # proxy - NOTE: ALWAYS use https://INSTANCE.service-now.com, not https://www.service-now.com/INSTANCE for web services URL from now on!
    proxy = 'https://%s:%s@%s.service-now.com/incident.do?SOAP' % (
        username, password, instance)
    namespace = 'http://www.service-now.com/'
    server = SOAPProxy(proxy, namespace)

    # uncomment these for LOTS of debugging output
    #server.config.dumpHeadersIn = 1
    #server.config.dumpHeadersOut = 1
    #server.config.dumpSOAPOut = 1
    #server.config.dumpSOAPIn = 1

    response = server.insert(
        impact=int(params_dict['impact']),
        urgency=int(params_dict['urgency']),
        priority=int(params_dict['priority']),
        category=params_dict['category'],
        location=params_dict['location'],
        caller_id=params_dict['user'],
        assignment_group=params_dict['assignment_group'],
        assigned_to=params_dict['assigned_to'],
        short_description=params_dict['short_description'],
        comments=params_dict['comments'])

    return response
Ejemplo n.º 15
0
 def __init__(self, url, namespace = None, authCallback = None, debug = 0,
              config = None, faultHandler = None):
     """
     @param url: the url to the service
     @param namespace: the namespace for the service
     @param authCallback: LEGACY
     @param debug: a debugging flag
     @type url: string
     @type namespace: string
     @type authCallback: python method
     @type debug: 0 or 1
     """
     if config == None:
         self.config = SOAPConfig(debug = debug)
     else:
         self.config = config
         
     self.config.debug = debug
     self.config.faultHandler = faultHandler
     print "URL: ", url
     self.url = url.replace('https', 'http')
     self.proxy = None
     self.namespace = namespace
     self.authCallback = authCallback
     self.proxy = SOAPProxy(self.url, self.namespace, config = self.config)
Ejemplo n.º 16
0
class BoostDispatcher(Dispatcher):
    """The smsd dispatcher for Boost Communications' External Sender."""

    def __init__(self, config):
        """Constructor."""

        # Call mother's init
        Dispatcher.__init__(self)

        # Get config
        try:
            # Remote address for gateway
            self.url = config['url']
            # Username for WebService
            self.username = config['username']
            # Password for WebService
            self.password = config['password']
            # Our phonenumber
            self.sender = config['sender']
        except KeyError, error:
            raise DispatcherError, "Config option not found: %s" % error

        # Initiate connector to Boost
        try:
            self.service = SOAPProxy(self.url)
        except Exception, error:
            raise DispatcherError, "Failed to initialize SOAPProxy: %s" % error
Ejemplo n.º 17
0
 def _get_dte_status(self, signature_d, token):
     url = server_url[
         self.company_id.dte_service_provider] + 'QueryEstDte.jws?WSDL'
     ns = 'urn:' + server_url[
         self.company_id.dte_service_provider] + 'QueryEstDte.jws'
     _server = SOAPProxy(url, ns)
     receptor = self.format_vat(self.partner_id.vat)
     date_invoice = datetime.strptime(self.date_invoice,
                                      "%Y-%m-%d").strftime("%d-%m-%Y")
     respuesta = _server.getEstDte(
         signature_d['subject_serial_number'][:8],
         str(signature_d['subject_serial_number'][-1]),
         self.company_id.vat[2:-1], self.company_id.vat[-1], receptor[:8],
         receptor[2:-1], str(self.document_class_id.sii_code),
         str(self.sii_document_number), date_invoice,
         str(self.amount_total), token)
     self.sii_message = respuesta
     resp = xmltodict.parse(respuesta)
     if resp['SII:RESPUESTA']['SII:RESP_HDR']['ESTADO'] == '2':
         status = {
             'warning': {
                 'title': _("Error code: 2"),
                 'message':
                 _(resp['SII:RESPUESTA']['SII:RESP_HDR']['GLOSA'])
             }
         }
         return status
     if resp['SII:RESPUESTA']['SII:RESP_HDR']['ESTADO'] == "EPR":
         self.state = "Proceso"
         if resp['SII:RESPUESTA']['SII:RESP_BODY']['RECHAZADOS'] == "1":
             self.state = "Rechazado"
         if resp['SII:RESPUESTA']['SII:RESP_BODY']['REPARO'] == "1":
             self.state = "Reparo"
     elif resp['SII:RESPUESTA']['SII:RESP_HDR']['ESTADO'] == "RCT":
         self.state = "Rechazado"
Ejemplo n.º 18
0
def brenda_query(EC_number, brenda_email="", brenda_pass=""):
    """
    Returns raw output string from BRENDA for an EC number.
    """
    
    # in some intranets an issue: how to use a web proxy for WS. Here
    # we assume a set environment variable 'http_proxy'.·
    # This is common in unix environments. SOAPpy does not like
    # a leading 'http://'
    if 'http_proxy' in os.environ.keys():
        my_http_proxy=os.environ["http_proxy"].replace("http://","")
    else:
        my_http_proxy=None

    endpointURL = "http://www.brenda-enzymes.org/soap/brenda_server.php"
    proxy = SOAPProxy(endpointURL, http_proxy=my_http_proxy)
    password = hashlib.sha256(brenda_pass).hexdigest()
    parameters = brenda_email + ',' + password + ',ecNumber*' + EC_number

    new_EC = proxy.getEcNumber(parameters)
    
    if('transferred to' in new_EC):
        new_EC = new_EC.rsplit(' ', 1)[1]
        new_EC = new_EC[:-1]
        parameters = brenda_email + ',' + password + ',ecNumber*' + new_EC
    
    brenda_response = proxy.getTurnoverNumber(parameters)

    return parse_brenda_raw_output(brenda_response)
Ejemplo n.º 19
0
def Hostgroup(device,hostgroup,host_list): 
#get information on the Host group 
        proxy = 'https://'+sHost+'/AFA/php/ws.php?wsdl'
        host_Dat=''
        namespace = 'https://www.algosec.com/afa-ws'
        soapaction='https://www.algosec.com/afa-ws/GetEntityNameRequest'
        server = SOAPProxy(proxy, namespace,soapaction)
        if "|" in hostgroup: #handles mutiple hostgroup
                hostgroup=hostgroup.split("|")
                #print hostgroup
                for hosts in hostgroup:
                        if hosts in host_list:
                                host=host_list[hosts]
                        else:
                                host=server.GetHostGroupNameDeviceRequest(SessionID=SessionID,DeviceID=device,HostGroupName=hosts) #soap function to get hostgroup
                                #sends the request to get host
                                host=str(host)
                                host=host.split('>:')
                                host.pop(0)
                                host=host[0]
                                replacement_list=[" ","'","]",'"',"{","}"]
                                for items in replacement_list:
                                        host=host.replace(items,"")
                        #print host
                                host=host.split(",")
                                ctr=0
                                host=str(host[:])
                                host=host.replace(']',"") #cleans data
                                host=host.replace('[',"")
                                host=host.replace("'","")
                                host=host.split(",")
                                host='\n'.join(host)
                        host_Dat=host_Dat+"\n"+"\n"+host
                host_Dat=host_Dat[2:]
                host=host_Dat
        else:
                if hostgroup in host_list:
                        host=host_list[hostgroup]
                else:
                        host=server.GetHostGroupNameDeviceRequest(SessionID=SessionID,DeviceID=device,HostGroupName=hostgroup)
                        #sends the request to get host
                        host=str(host)
                        host=host.split('>:')
                        host.pop(0)
                        host=host[0]
                        replacement_list=[" ","'","]",'"',"{","}"]
                        for items in replacement_list:
                                host=host.replace(items,"")
                        #print host
                        host=host.split(",")
                        host=str(host[:])
                        host=host.replace(']',"")
                        host=host.replace('[',"") #cleans the data 
                        host=host.replace("'","")
                        host=host.replace(" ","")
                        host=host.split(",")
                        host='\n'.join(host)
                        ctr=0
        return host
Ejemplo n.º 20
0
def DisconnectAFA(params):
        # deconnects from algosec
        SessionID = params['SessionID']
        proxy = 'https://'+sHost+'/AFA/php/ws.php?wsdl'
        namespace = 'https://www.algosec.com/afa-ws'
        server = SOAPProxy(proxy, namespace)
        response = server.DisconnectRequest(SessionID=SessionID)
        return response
Ejemplo n.º 21
0
 def access_protocol(self):
     '''
     Define the accession protocol information 
     '''
     self.endpointURL = "https://www.brenda-enzymes.org/soap/brenda_server.php"
     self.password = hashlib.sha256(self.pswrd).hexdigest()
     self.client = SOAPProxy(self.endpointURL)
     return None
Ejemplo n.º 22
0
 def get_token(self, seed_file,company_id):
     url = server_url[company_id.dte_service_provider] + 'GetTokenFromSeed.jws?WSDL'
     ns = 'urn:'+ server_url[company_id.dte_service_provider] +'GetTokenFromSeed.jws'
     _server = SOAPProxy(url, ns)
     tree = etree.fromstring(seed_file)
     ss = etree.tostring(tree, pretty_print=True, encoding='iso-8859-1')
     respuesta = etree.fromstring(_server.getToken(ss))
     token = respuesta[0][0].text
     return token
Ejemplo n.º 23
0
  def __init__(self, host, secret):
    """ Creates a UAClient instance.

    Args:
      host: A string specifying the location of the UAServer.
      secret: A string specifying the deployment secret.
    """
    self.secret = secret
    self.server = SOAPProxy('https://{}:{}'.format(host, UA_SERVER_PORT))
Ejemplo n.º 24
0
def getProxy( url, namespace, http_proxy ):    
    if SOAPpy:
        return SOAPProxy( url,
                          namespace  = namespace,
                          http_proxy = http_proxy )
    
    else:
        return SOAP.SOAPProxy( url,
                               namespace  = namespace,
                               http_proxy = http_proxy )
Ejemplo n.º 25
0
def ConnectAFA(params):
#starts the connection to algosec 
        username = params['UserName']
        password = params['Password']
        domain = params['Domain'] 
        proxy = 'https://'+sHost+'/AFA/php/ws.php?wsdl'
        namespace = 'https://www.algosec.com/afa-ws'
        soapaction='https://www.algosec.com/afa-ws/GetEntityNameRequest'
        server = SOAPProxy(proxy, namespace,soapaction)
        response = server.ConnectRequest(UserName=username, Password=password, Domain=domain)
        return response
Ejemplo n.º 26
0
 def get_seed(self, company_id):
     #En caso de que haya un problema con la validación de certificado del sii ( por una mala implementación de ellos)
     #esto omite la validacion
     import ssl
     ssl._create_default_https_context = ssl._create_unverified_context
     url = server_url[company_id.dte_service_provider] + 'CrSeed.jws?WSDL'
     ns = 'urn:'+server_url[company_id.dte_service_provider] + 'CrSeed.jws'
     _server = SOAPProxy(url, ns)
     root = etree.fromstring(_server.getSeed())
     semilla = root[0][0].text
     return semilla
Ejemplo n.º 27
0
 def _GetClient(use_soap=True):
     if use_soap:
         # create the SOAP client object
         #endpointURL = "http://www.brenda-enzymes.org/soap2/brenda_server.php"
         endpointURL = "http://www.brenda-enzymes.org/soap/brenda_server.php"
         return SOAPProxy(endpointURL)
     else:
         import WSDL
         # create the WSDL SOAP client object
         wsdl = "http://www.brenda-enzymes.org/soap2/brenda.wsdl"
         return WSDL.Proxy(wsdl)
Ejemplo n.º 28
0
    def _get_test_case_messages(self):
        """
        Get if received MMI, AT messages

        :rtype: tuple
        :return: A tuple of value containing (message_type, message)
        message_type = MMI, AT
        """

        message_type = "NONE"
        message = "No message available"

        # Get MMi Messages first
        mmi_message = SOAPProxy(self._prj_explorer_service,
                                throw_faults=0).doGetNextMmiMessage()

        if "No MMI message available" in mmi_message:
            # Get AT comment if no MMi messages
            soap_response = SOAPProxy(self._prj_explorer_service,
                                      throw_faults=0).doGetNextAtCommand()

            if "No AT command available" in soap_response:
                self._logger.debug("Network simulator: No message available")
                message_type = "NONE"
                message = "No message available"

            else:
                at_command = soap_response._asdict()
                self._logger.debug(
                    "Network simulator: Received AT Command - %s" % at_command)
                message_type = "AT"
                message = at_command.get('COMMAND')

        else:
            self._logger.debug("Network simulator: Received MMI Message - %s" %
                               mmi_message)
            message_type = "MMI"
            message = mmi_message

        message = message.replace('\r', '')
        return message_type, message
Ejemplo n.º 29
0
def consultarCliente(codigoCliente):
	try:	
		servico_venda = SOAPProxy("http://localhost:8009")
		vendas_linhas = servico_venda.listarVenda()
		
		for vendas_linhas in venda_linha:
			codigoVenda, codigoClienteVenda, codigoFuncionario, data, valortotal, codigoProduto, quantidadecodigoVenda, codigoCliente, codigoFuncionario, data, valortotal, codigoProduto, quantidade = venda_linha.split('|')
			if codigoClienteVenda == codigoCliente:
				return True
		return False
	except:
		return False
Ejemplo n.º 30
0
    def __init__(self, host, secret):
        """ Creates a UAClient instance.

    Args:
      host: A string specifying the location of the UAServer.
      secret: A string specifying the deployment secret.
    """
        # Disable certificate verification for Python >= 2.7.9.
        if hasattr(ssl, '_create_unverified_context'):
            ssl._create_default_https_context = ssl._create_unverified_context

        self.secret = secret
        self.server = SOAPProxy('https://{}:{}'.format(host, UA_SERVER_PORT))