def main(ip): from wsgiref.simple_server import make_server soap_application = soaplib.core.Application([LoginService], 'login') wsgi_application = wsgi.Application(soap_application) server = make_server(ip, 1236, wsgi_application) print "Setando servico Login" server.serve_forever()
def main(ip): from wsgiref.simple_server import make_server soap_application = soaplib.core.Application([DescriptionDAOService], 'description') wsgi_application = wsgi.Application(soap_application) server = make_server(ip, 1234, wsgi_application) print "Setando servico Description" server.serve_forever()
def main(ip): from wsgiref.simple_server import make_server soap_application = soaplib.core.Application([UserManagerService], 'usermanager') wsgi_application = wsgi.Application(soap_application) server = make_server(ip, 1235, wsgi_application) print "Setando servico Loan" server.serve_forever()
def service_inception(host, port): from soaplib.core.util.wsgi_wrapper import run_twisted targetNamespace = "guoqi" soap_app = soaplib.core.Application([InceptionService], targetNamespace) wsgi_app = wsgi.Application(soap_app) application = "sqlaudit" print 'wsdl is at: http://%s:%s/%s/?wsdl' % (host, port, application) run_twisted([(wsgi_app, application)], port)
def start_wsdl(): try: from wsgiref.simple_server import make_server soap_application = soaplib.core.Application([EodWorldService], 'tns') wsgi_application = wsgi.Application(soap_application) server = make_server('0.0.0.0', 7789, wsgi_application) print 'soap server starting......' server.serve_forever() except ImportError: print "Error: example server code requires Python >= 2.5"
def Run_Ser(): try: from wsgiref.simple_server import make_server soap_application = soaplib.core.Application([WorldServiceIntf], 'tns') wsgi_application = wsgi.Application(soap_application) server = make_server(sWebSerIp, 8092, wsgi_application) server.serve_forever() except ImportError: print 'WebService error' raw_input()
def service_Hello(host, port): targetNamespace = "guoqi" soap_app = soaplib.core.Application([HelloWorldService], targetNamespace) wsgi_app = wsgi.Application(soap_app) isMakeServer = False #isMakeServer = True if isMakeServer: print 'wsdl is at: http://%s:%s/?wsdl' % (host, port) try: from wsgiref.simple_server import make_server server = make_server(host, port, wsgi_app) server.serve_forever() except ImportError: print 'error' else: from soaplib.core.util.wsgi_wrapper import run_twisted application = "hello3" print 'wsdl is at: http://%s:%s/%s/?wsdl' % (host, port, application) run_twisted([(wsgi_app, application)], port)
def testSimpleWSDL(self): client_for_generator = suds.client.Client("file://"+os.path.abspath("wsdl2soaplib_test.wsdl")) code = wsdl2soaplib.generate(client_for_generator, "wsdl2soaplib_test.wsdl") py = open("wsdl2soaplib_test.py", "w") py.write(code) py.close() from wsdl2soaplib_test import Application as HelloWorldService soap_application = soaplib.core.Application([HelloWorldService], 'tns') wsgi_application = wsgi.Application(soap_application) server = make_server('localhost', 9000, wsgi_application) soap_server = multiprocessing.Process(target=server.serve_forever) soap_server.start() client = suds.client.Client("http://localhost:9000/?wsdl") self.assertEqual(client.service.say_hello(), None) with self.assertRaises(Exception): client.service.undefined_method() soap_server.terminate()
class RestService(DefinitionBase): @soap(String, Integer, _returns=Array(Array(String))) def rest(self, hotelName, selNum): print hotelName restList, hotelLocation, restraurantData = selHotel(hotelName) #print restList if selNum == 1: rest_list = rest_distance_recom(restraurantData, hotelLocation) if selNum == 2: rest_list = rest_price_recom(restraurantData, hotelLocation) if selNum == 3: rest_list = rest_rate_recom(restraurantData, hotelLocation) if selNum == 4: rest_list = rest_best_recom(restraurantData, hotelLocation) restList.append(rest_list) print restList return restList try: from wsgiref.simple_server import make_server soap_application = soaplib.core.Application([RestService], 'tns') wsgi_application = wsgi.Application(soap_application) server = make_server('localhost', 8090, wsgi_application) print 'soap server starting......' server.serve_forever() except ImportError: print "Error: example server code requires Python >= 2.5"
environ['REMOTE_USER'] = kerberos.authGSSServerUserName(context) kerberos.authGSSServerClean(context) elif type == 'Basic': username, password = b64decode(authstr).split(':', 1) try: kerberos.checkPassword(username, password, self.service, self.realm) except Exception, e: return noauth(e.message) new_start_response = start_response environ['REMOTE_USER'] = username return self.wrapped(environ, new_start_response) soap_application = core.Application([VLABManager], 'http://devel.avalon.ru/') application = KerberosAuth(wsgi.Application(soap_application), xcpconf.config['krbRealm']) if __name__ == '__main__': kinit = '/usr/bin/kinit' kinit_args = [ kinit, '%s@%s' % (xcpconf.config['krbLogin'], xcpconf.config['krbRealm']) ] kinit = Popen(kinit_args, stdin=PIPE, stdout=PIPE, stderr=PIPE) kinit.stdin.write('%s\n' % xcpconf.config['krbPassword']) kinit.wait() logging.basicConfig(level=logging.DEBUG) try: from wsgiref.simple_server import make_server
def Run_Tws(): soap_app=soaplib.core.Application([WorldServiceIntf], 'tns') wsgi_app=wsgi.Application(soap_app) # print 'listening on 218.4.64.93:8092' # print 'wsdl is at: http://218.4.64.93:8092/SOAP/?wsdl' run_twisted( ( (wsgi_app, "SOAP"),), 8092)