Exemplo n.º 1
0
 def set_auth_header(self):
     """Set up the authorization header"""
     auth_user = Element("username").setText(self.api_user)
     auth_key = Element("apiKey").setText(self.api_key)
     auth_header = Element("authenticate", ns=self.ims_ns)
     auth_header.children = [auth_user, auth_key]
     return auth_header
Exemplo n.º 2
0
def get_soap_header(user=username, passw=passw, nonce=nonce, date=date):
    WssSecurity = Element('wss:Security').setText(
        'xmlns:wss="http://schemas.xmlsoap.org/ws/2002/12/secext"')
    soapheader = Element('S:Header')  # create the parent element
    WssUsernameToken = Element('wss:UsernameToken')
    WssUsername = Element('wss:Username').setText(user)
    WssPassword = Element('wss:Password').setText(passw)
    WssNonce = Element('wss:Nonce').setText(nonce)
    WssCreated = Element('wss:Created').setText(date)
    WssSecurity.children = [WssUsernameToken]
    soapheader.children = [WssSecurity]
    WssUsernameToken.children = [
        WssUsername, WssPassword, WssNonce, WssCreated
    ]

    return soapheader
Exemplo n.º 3
0
 def set_object_mask(self, data):
     """Create an object mask to tell the API what we want"""
     print "%sObjectMask" % self.object_type
     el = Element("%sObjectMask" % self.object_type, ns=self.ims_ns)
     mask = Element("mask")
     mask = self.build_soap_header(mask, data)
     el.children = [mask]
     return el
Exemplo n.º 4
0
def infoGeneral():
    #Definimos URLs de Acceso a los Webservices
    urlGeneral = 'http://academico.espoch.edu.ec/OAS_Interop/Infogeneral.wsdl'
    clienteGeneral = Client(urlGeneral)
    #Definimos el nombre de usuario
    user = Element('acad:username').setText('webmail')

    #Definimos la contraseña
    pwd = Element('acad:password').setText('webmail')
    #Creamos el elemento padre, y el espacio de nombres
    reqsoapheader = Element('acad:credentials', ns=['acad','http://academico.espoch.edu.ec/'])
    #agregamos usuario y contraseña al padre
    reqsoapheader.children = [user, pwd]
    clienteGeneral.set_options(soapheaders=reqsoapheader)
    return clienteGeneral
Exemplo n.º 5
0
def infoCarrera():
    #Definimos URLs de Acceso a los Webservices
    urlCarrera = 'http://academico.espoch.edu.ec/OAS_Interop/Infocarrera.wsdl'
    #Creamos el clientes
    clienteCarrera = Client(urlCarrera)
    #Definimos el nombre de usuario
    user = Element('acad:username').setText('webmail')
    #Definimos la contraseña
    pwd = Element('acad:password').setText('webmail')
    #Creamos el elemento padre, y el espacio de nombres
    reqsoapheader = Element('acad:credentials', ns=['acad','http://academico.espoch.edu.ec/'])
    #agregamos usuario y contraseña al padre
    reqsoapheader.children = [user, pwd]
    #Seteamos los soapheaders con las credenciales de login
    clienteCarrera.set_options(soapheaders=reqsoapheader)
    return clienteCarrera
Exemplo n.º 6
0
from suds.client import Client
from suds.transport.http import HttpAuthenticated

url = 'http://academico.espoch.edu.ec/OAS_Interop/Infogeneral.wsdl'
#url adicional
urlCarrera = 'http://academico.espoch.edu.ec/OAS_Interop/Infocarrera.wsdl'

cliente = Client(url)
from suds.sax.element import Element

#Definimos el nombre de usuario
user = Element('acad:username').setText('webmail')

#Definimos la contraseña
pwd = Element('acad:password').setText('webmail')

#Creamos el elemento padre, y el espacio de nombres
reqsoapheader = Element('acad:credentials', ns=['acad','http://academico.espoch.edu.ec/'])

#agregamos usuario y contraseña al padre
reqsoapheader.children = [user, pwd]

#Seteamos los soapheaders con las credenciales de login
cliente.set_options(soapheaders=reqsoapheader)

#Llamamos a los servicios web
a = cliente.service.GetCiudades()

print a
Exemplo n.º 7
0
WssToken = Element('wss:UsernameToken')
WssSecurity = Element('wss:Security').setText(
    'xmlns:wss="http://schemas.xmlsoap.org/ws/2002/12/secext"')
reqsoapheader = Element('S:Header')  # create the parent element
WssUsernameToken = Element('wss:UsernameToken')
WssUsername = Element('wss:Username').setText('599999993/37')
WssPassword = Element('wss:Password').setText('ikCyRV+SWfvZ5c6Q0bhrBQ==')
WssNonce = Element('wss:Nonce').setText(
    '''fkAHne7cqurxpImCfBC8EEc2vskyUyNofWi0ptIijYg4gYCxir++unzfPVPpusloEtmLkcZjf+E6
	T9/76tsCqdupUkxOhWtkRH5IrNwmfEW1ZGFQgYTF21iyKBRzMdsJMhhHrofYYV/YhSPdT4dlgG0t
	k9Z736jFuw061mP2TNqHcR/mQR0yW/AEOC6RPumqO8OAfc9/b4KFBSfbpY9HRzbD8bKiTo20n0Pt
	amZevCSVHht4yt/Xwgd+KV70WFzyesGVMOgFRTWZyXyXBVaBrkJS8b6PojxADLcpWRnw5+YeOs3c
	PU2o1H/YgAam1QuEHioCT2YTdRt+9p6ARNElFg==''')
WssCreated = Element('wss:Created').setText(
    '>YEWoIoqIY5DOD11SeXz+0i4b/AJg1/RgNcOHOYpSxGk')
WssSecurity.children = [WssUsernameToken]
reqsoapheader.children = [WssSecurity]
WssUsernameToken.children = [WssUsername, WssPassword, WssNonce, WssCreated]

print reqsoapheader
"""
<S:Header>
<wss:Security xmlns:wss="Createdhttp://schemas.xmlsoap.org/ws/2002/12/secext">
	<wss:UsernameToken>
	<wss:Username>599999993/37</wss:Username>
	<wss:Password>ikCyRV+SWfvZ5c6Q0bhrBQ==</wss:Password>
	<wss:Nonce>
	fkAHne7cqurxpImCfBC8EEc2vskyUyNofWi0ptIijYg4gYCxir++unzfPVPpusloEtmLkcZjf+E6
	T9/76tsCqdupUkxOhWtkRH5IrNwmfEW1ZGFQgYTF21iyKBRzMdsJMhhHrofYYV/YhSPdT4dlgG0t
	k9Z736jFuw061mP2TNqHcR/mQR0yW/AEOC6RPumqO8OAfc9/b4KFBSfbpY9HRzbD8bKiTo20n0Pt
	amZevCSVHht4yt/Xwgd+KV70WFzyesGVMOgFRTWZyXyXBVaBrkJS8b6PojxADLcpWRnw5+YeOs3c
Exemplo n.º 8
0
#!/usr/bin/python
from suds.client import Client 
from SOAPpy import WSDL
from suds.sax.element import Element
from suds.sax.attribute import Attribute
import logging


logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.basicConfig(filename="/tmp/suds.log", level=logging.INFO)


url = 'http://1ocalhost/SDP_SMS/parlayx_sms_notification_manager_service_2_3.wsdl'
client = Client(url, location='http://196.201.216.14:8310/SmsNotificationManagerService/services/SmsNotificationManager')
spId = Element('spId').setText('35000001')
spPassword = Element('spPassword').setText('somepassword')
serviceId = Element('serviceId').setText('12345')
timeStamp = Element('timeStamp').setText('20120731064245')
reqsoapheader = Element('RequestSOAPHeader')
reqsoapheader.children = [spId,spPassword,serviceId,timeStamp]
client.set_options(soapheaders=reqsoapheader)

reference = client.factory.create('ns0:SimpleReference')
reference.endpoint = 'http://localhost/index.php'
reference.interfaceName = 'notifySmsReception'
reference.correlator = '1234'
reference.smsServiceActivationNumber = '23424'
reference.criteria = 'Love'
client.service.startSmsNotification('http://localhost/index.php','notifySmsReception','1234', '23424', 'Love')
print client.last_received()
Exemplo n.º 9
0
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.basicConfig(filename="/tmp/sendSms.log", level=logging.INFO)


url = 'http://localhost/parlayx_sms_send_service_2_2.wsdl'
client = Client(url, location='http://localhost:8310/SendSmsService/services/SendSms')
passw = cryp.update('12345'+'pass'+'20130402115545')
password = cryp.hexdigest()
#print client 
spId = Element('spId').setText('1234')
spPassword = Element('spPassword').setText(password)
serviceId = Element('serviceId').setText('12345')
timeStamp = Element('timeStamp').setText('20130402115545')
linkId = Element('linkid').setText('')
oa = Element('OA').setText('tel:254706123456')
fa = Element('FA').setText('tel:254706123456')

reqsoapheader = Element('RequestSOAPHeader')
reqsoapheader.children = [spId,spPassword,serviceId,timeStamp,linkId,oa,fa]
client.set_options(soapheaders=reqsoapheader)
reference = client.factory.create('ns0:SimpleReference')
reference.endpoint = 'http://localhost/index.php'
reference.interfaceName = 'SmsNotification'
reference.correlator = '12345678'

client.service.sendSms('254706123456','949','0','This is a test message from Simon',reference)
#print client.last_sent()

print client.last_received()