def __start(self): """ start application server in new thread """ self.__init_node() servers = self.database.execute(sql_get_all_cluster_nodes % self.config.cluster_id) for server in servers: if self.config.system_transport.lower() == "https": client = make_service_client( "https://%s:%s/NodeManagement" % (server[1], self.config.ssl_port), self.node_mgt_app ) client.rem_port = self.config.ssl_port else: client = make_service_client( "http://%s:%s/NodeManagement" % (server[1], self.config.http_port), self.node_mgt_app ) client.rem_port = self.config.http_port client.rem_host = server[1] self.cluster.append(client) try: shutil.rmtree(APPLICATION_DIR) shutil.rmtree(SHARED_LIB_DIR) except: pass os.mkdir(APPLICATION_DIR) os.mkdir(SHARED_LIB_DIR) rets = self.database.execute(sql_get_shared_libraries % self.config.cluster_id) for id in rets: self.load_shared_library(id[0]) rets = self.database.execute(sql_get_all_cluster_applications % self.config.cluster_id) for id in rets: self.start_application(id[0]) self.stoped = False self.stoping = False thread.start_new_thread(self._start_thread, (self.server,)) thread.start_new_thread(self._start_thread, (self.secure_server,)) while (not self.server.ready) and (not self.stoped): # while staring time.sleep(1) while (not self.secure_server.ready) and (not self.stoped): # while staring time.sleep(1) if not self.stoped: self.logger.log("Application Server node started!") thread.start_new_thread(self.log_dispatcher, ()) self.start_datetime = datetime.now()
def __init__(self, path, applicationName, applicationPassword, clientValidationInterval): self.client = make_service_client( path + '/crowd/services/SecurityServer', SecurityServer()) self.applicationName = applicationName self.applicationPassword = applicationPassword self.clientValidationInterval = clientValidationInterval
def SetServiceInfo(self, serviceURI, serviceName): try: parts = serviceName.split(".") item = __import__(".".join(parts[:-1])) for part in parts[1:]: item = getattr(item, part) self.client_type = item() self.client = make_service_client(str(serviceURI), self.client_type) except: raise COMException("No such service", winerror.DISP_E_BADVARTYPE)
def SetServiceInfo(self, serviceURI, serviceName): try: parts = serviceName.split('.') item = __import__('.'.join(parts[:-1])) for part in parts[1:]: item = getattr(item, part) self.client_type = item() self.client = make_service_client(str(serviceURI), self.client_type) except: raise COMException('No such service', winerror.DISP_E_BADVARTYPE)
def __init__(self, url, prefix = None, certfile = None, keyfile = None, *args, **kw): serializer = T1Serializer(self) super(T1SoapClient, self).__init__(url = url, prefix = prefix, serializer = serializer, *args, **kw) self.__t1 = make_service_client(url, SOAPFrontendService(), certfile = certfile, keyfile = keyfile)
# externally accessible interface global server server = CherryPyWSGIServer((localIp(), portNo), BiFa()) print "Started serving:" server.start() if __name__=='__main__': # userData = userDataClass() # regenerate the wsdl at every startup. This is not # needed but keeps the code accessible. # Server address is a dummy client = make_service_client('http://%s' % (localIp()), BiFa()) f1 = open("bifa.wsdl", 'w') f1.write(client.server.wsdl('')) # Need to flush before close, otherwise we only get 4096 bytes! f1.flush() f1.close() f2 = file("config.dat") for line in f2: line = line.strip() key = line[ : line.find('=') ].strip() value = line[ line.find('=') + 1 : ].strip() if (key == "port"): portNo = int(value) f2.close()
def make_client(): from soaplib.client import make_service_client client = make_service_client('http://localhost:7889/', HelloWorldService()) return client
__author__ = 'Scott' import getpass from soaplib.client import make_service_client from webService import EbayServ #client try: client = make_service_client('http://localhost:8080/ebay',EbayServ()) except: print "Client failed" try: client.service_login("bkt5031", "H464Jd$") # Json sent back, with permissions # Get message from rabbitmq except: print "Login Failed"
import sys sys.path.append('..') from soaplib.client import make_service_client from jishinServer import jishinService import getpass from ConstantValues.Constants import constantsclass username = '' password = '' while username == '' or password == '': username = raw_input('Enter your Username: '******'no messages' jishin = make_service_client('http://localhost:8080/loginUser', jishinService()) try: token = jishin.loginUser(username, password) if token == constantsclass.INCORRECT_PASSWORD: print token else: while messages: messages = jishin.receivePrediction(token) if messages: for m in messages: print m else: print 'No More Messages In Queue' except Exception as e:
# You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 # ''' This example shows how to parse wsdl created by the classserializer.py server and use the dynamically generated objects as a client ''' from soaplib.parsers.wsdlparse import WSDLParser import lxml.etree as et import urllib2 as ulib from soaplib.client import make_service_client wp = WSDLParser.from_url('http://localhost:7789/wsdl') UserManager = wp.services['UserManager'] User = wp.ctypes['{UserManager.UserManager}User'] user = User() user.username = '******' user.firstname = 'john' user.surname = 'smith' client = make_service_client('http://localhost:7789/', UserManager()) userid = client.add_user(user) print "adding user - id: %s" % userid users = client.list_users() for u in users: print u.username
# Author: Osei Seraphin # Course: IST 440w # Instructor: Professor Oakes import sys sys.path.append('..') from soaplib.client import make_service_client from jishinServer import jishinService import getpass from ConstantValues.Constants import constantsclass username = raw_input('Enter your Username: '******'http://localhost:8080/loginUser', jishinService()) try: token = jishin.loginUser(username, password) if token == constantsclass.INCORRECT_PASSWORD: print token else: # Call API Update Script update = jishin.updateApi(token) if update: print 'Update Successful' else: print 'Update Unsuccessful' except Exception as e: print e
def run(): time.sleep(seconds) client = make_service_client(replyto, self) client.woke_up('good morning', msgid=msgid)
#Author: Alex Remaker #Date: 10/25/2015 #Desc: This module is used by the client to make web service requests to the server import sys from precision_stock_predicter.logging import logHelper from soaplib.client import make_service_client from wsServer import StockService import getpass try: symbol = raw_input("Enter symbol: ") daysToGet = raw_input("Enter days to get: ") username = raw_input("Username: "******"Web service failed." +e, "wsCoeint") print "Web service failed." +e
def __init__(self, path, applicationName, applicationPassword, clientValidationInterval): self.client = make_service_client(path + '/crowd/services/SecurityServer',SecurityServer()) self.applicationName = applicationName self.applicationPassword = applicationPassword self.clientValidationInterval = clientValidationInterval
def AgentClient(agent_class = None, host = 'localhost', port = 8915): return make_service_client('http://%s:%d' % (host, port), AgentServer(agent_class))
from soaplib.wsgi_soap import SimpleWSGISoapApp from soaplib.service import soapmethod from soaplib.serializers.primitive import String, Integer, Array from soaplib.client import make_service_client from soaplib.client import debug USERNAME = '******' PASSWORD = '******' ACCOUNT = 'account' class SingularService(SimpleWSGISoapApp): __tns__ = 'http://www.galotecnia.com/soap/' @soapmethod(String, Integer, _returns=Array(String)) def say_hello(self, name, times): pass @soapmethod(String, String, String, String, String, _returns=Integer) def sendSMS(self, username, password, account, phoneNumber, text): pass debug(True) client = make_service_client('https://demo.galotecnia.com/singularms/ws/', SingularService()) greetings = client.say_hello("Test", 10) for g in greetings: print g #print client.sendSMS(USERNAME, PASSWORD, ACCOUNT, '34686202609', 'Desde ltsp')
KEGG_wsdl = 'http://soap.genome.jp/KEGG.wsdl' class KeggService(SimpleWSGISoapApp): __tns__ = 'SOAP/KEGG' @soapmethod( String, _returns=String, _inMessage='bconvRequest', _outMessage='bconvResponse', _outVariableName='return' ) def bconv(self, id): pass client = make_service_client(KEGG_wsdl, KeggService()) print client.bconv("ncbi-gi:10047086 ncbi-gi:10047090 ncbi-geneid:14751") raise tp = transcriptional_programs[27] #for g in tp.tp_targets: # print ensembl_names[g] def gene_name(gene): return ensembl_names.get(str(gene))
Purpose: Client side JWT handling Course: IST 440W Date: 11/3/2015 Revision: 2 """ from soaplib.client import make_service_client from serverWSResponseJWT import HelloService import jwt import base64 import datetime import sys import log import traceback client = make_service_client('http://localhost:8080/webtoken', HelloService()) key = 'secret' exp = datetime.datetime.now() + datetime.timedelta(days=1) payload = {'usr':"******",'exp':exp} token = jwt.encode(payload, key, 'HS256') try: response = client.webtoken(token) print response except Exception as e: log.error(traceback.format_exc()) print 'error'
from soaplib.client import make_service_client from test import HelloService client = make_service_client('http://localhost:8080/TwoNumbers', HelloService()) n1 = raw_input("Enter a number: ") n2 = raw_input("Enter another number: ") response = client.TwoNumbers(n1, n2) print response
#!/usr/bin/env python # # soaplib - Copyright (C) 2009 Aaron Bickell, Jamie Kirkpatrick # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 # from soaplib.client import make_service_client from soaplib.serializers.binary import Attachment from helloworld_attach import HelloWorldService from soaplib.client import debug debug(True) client = make_service_client("http://localhost:7789/", HelloWorldService()) print client.say_hello(Attachment(data="Dave"), 5, mtom=True)
def run(): time.sleep(seconds) client = make_service_client(replyto, self) client.woke_up('good morning', msgid=msgid)
def make_client(): from soaplib.client import make_service_client client = make_service_client('http://localhost:7889/', DocumentArchiver()) return client
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 # ''' This example shows how to parse wsdl created by the classserializer.py server and use the dynamically generated objects as a client ''' from soaplib.parsers.wsdlparse import WSDLParser import lxml.etree as et import urllib2 as ulib from soaplib.client import make_service_client wp = WSDLParser.from_url('http://localhost:7789/wsdl') UserManager = wp.services['UserManager'] User = wp.ctypes['{UserManager.UserManager}User'] user = User() user.username = '******' user.firstname = 'john' user.surname = 'smith' client = make_service_client('http://localhost:7789/', UserManager()) userid = client.add_user(user) print "adding user - id: %s" % userid users = client.list_users() for u in users: print u.username
from soaplib.client import make_service_client from test import HelloService client = make_service_client("http://localhost:8080/TwoNumbers", HelloService()) n1 = raw_input("Enter a number: ") n2 = raw_input("Enter another number: ") response = client.TwoNumbers(n1, n2) print response
import sys sys.path.append(".") import re import bookfinder_service from soaplib.client import make_service_client from bookfinder_service import BookfinderService client = make_service_client('http://*****:*****@route('/search', method='GET') def search_books(): titles1 = [] titles2 = [] titles3 = [] prices1 = [] pricesto1 =[] prices2 = [] pricesto2 =[] prices3 = [] pricesto3 =[] urls1 = [] urls2 = [] urls3 = [] items1 = [] items2 = [] items3 = [] if request.GET.get('search','').strip():
Purpose: Client side JWT handling Course: IST 440W Date: 11/3/2015 Revision: 2 """ from soaplib.client import make_service_client from serverWSResponseJWT import HelloService import jwt import base64 import datetime import sys import log import traceback client = make_service_client('http://localhost:8080/webtoken', HelloService()) key = 'secret' exp = datetime.datetime.now() + datetime.timedelta(days=1) payload = {'usr': "******", 'exp': exp} token = jwt.encode(payload, key, 'HS256') try: response = client.webtoken(token) print response except Exception as e: log.error(traceback.format_exc()) print 'error'
def make_client(): from soaplib.client import make_service_client client = make_service_client('http://localhost:7889/', DocumentArchiver()) return client
def make_client(): from soaplib.client import make_service_client client = make_service_client('http://localhost:7889/', HelloWorldService()) return client
from soaplib.serializers.primitive import String, Integer, Array, Float KEGG_wsdl = 'http://soap.genome.jp/KEGG.wsdl' class KeggService(SimpleWSGISoapApp): __tns__ = 'SOAP/KEGG' @soapmethod(String, _returns=String, _inMessage='bconvRequest', _outMessage='bconvResponse', _outVariableName='return') def bconv(self, id): pass client = make_service_client(KEGG_wsdl, KeggService()) print client.bconv("ncbi-gi:10047086 ncbi-gi:10047090 ncbi-geneid:14751") raise tp = transcriptional_programs[27] #for g in tp.tp_targets: # print ensembl_names[g] def gene_name(gene): return ensembl_names.get(str(gene)) def gene_names(genes): return ifilter(None, imap(gene_name, genes))
from soaplib.client import make_service_client from test import HelloService client = make_service_client('http://localhost:8080/hello', HelloService()) test = raw_input('Type in Hello') response = client.hello('Who is Sheena- this is a testing') print response
#!/usr/bin/env python # # soaplib - Copyright (C) 2009 Aaron Bickell, Jamie Kirkpatrick # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 # from soaplib.client import make_service_client from soaplib.serializers.binary import Attachment from helloworld_attach import HelloWorldService from soaplib.client import debug debug(True) client = make_service_client('http://localhost:7789/', HelloWorldService()) print client.say_hello(Attachment(data="Dave"), 5, mtom=True)
def onWsdl(self, environ, wsdl): client = make_service_client('http://%s' % (localId), BiFa()) return client.server.wsdl('') '''
__author__ = 'Scott' import getpass from soaplib.client import make_service_client from webService import EbayServ #client try: client = make_service_client('http://localhost:8080/ebay', EbayServ()) except: print "Client failed" try: client.service_login("bkt5031", "H464Jd$") # Json sent back, with permissions # Get message from rabbitmq except: print "Login Failed"
''' Created on Jul 16, 2012 @author: leal ''' from soaplib.client import make_service_client from test2_server import HelloService client = make_service_client('http://localhost:8080/hello', HelloService()) inputMsg = 'Ricardo' print 'Sending to server: ', inputMsg retMsg = client.hello(inputMsg) print 'Server sent back <' + retMsg + '>'
def main(): from soaplib.client import make_service_client client = make_service_client('http://localhost:9999/', HelloWorldService()) print client.say_hello("Dave",5)