def xgj_main_task(): application = Application([DRMSService], 'http://webservice.ack.dns.act.com/', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11()) wsgi_app = WsgiMounter({'DNSWebService': application}) server = make_server('0.0.0.0', listen_port, wsgi_app) server.serve_forever()
def main_task(): application = Application([DRMSService], tns = 'http://webservice.ack.dns.act.com/', in_protocol = Soap11(validator = 'lxml'), out_protocol = Soap11()) from wsgiref.simple_server import make_server global port #wsgi_app = WsgiApplication(application) wsgi_app = WsgiMounter({'DNSWebService' : application}) server = make_server('0.0.0.0', port, wsgi_app) server.serve_forever() pass
def geometry_service(fcgi=True): if fcgi is False: def _on_method_return_object(ctx): ctx.transport.resp_headers['Access-Control-Allow-Origin'] = "*" ctx.transport.resp_headers['Cache-Control'] = "public,max-age=86400" # tbd GeometryService.event_manager.add_listener('method_return_object', _on_method_return_object) json = Application([GeometryService], tns='swhv.service.geometry.json', in_protocol=HttpRpc(validator='soft'), out_protocol=JsonDocument()) msgpack = Application([GeometryService], tns='swhv.service.geometry.msgpack', in_protocol=HttpRpc(validator='soft'), out_protocol=MessagePackDocument()) return WsgiMounter({'json': json, 'msgpack': msgpack})
def main_task(): listen_port = 18899 logger = logging.getLogger('drmsd') logger.setLevel(level=logging.INFO) handler = logging.FileHandler( "/home/heweiwei/drms/test/cxfreeze/service.log") handler.setLevel(logging.INFO) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) logger.addHandler(handler) application = Application([DRMSService], 'http://webservice.ack.dns.act.com/', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11()) wsgi_app = WsgiMounter({'DNSWebService': application}) server = make_server('0.0.0.0', listen_port, wsgi_app) logger.info('server at port 18899 start') server.serve_forever()
LOG_FOLDER = os.environ["LOG_FOLDER"] logfile = os.path.join(LOG_FOLDER, "producer_log.txt") #logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO, filename=logfile, format='%(levelname)s: %(asctime)s %(message)s') logging.info(f"logging to console and file {logfile}") # We use the wsgi mounter to hook up potentially more than one SOAP service # inside a single app. app1 = WsgiApplication(KafkaProducerService.create_app()) app1.doc.wsdl11.build_interface_document("https://srv.hetcomp.org/demo-kafka-producer/KafkaProducerService") application = WsgiMounter({ KafkaProducerService.SERVICENAME: app1 }) if __name__ == '__main__': # Only for debugging! (Will start the app in a simple Python thread # without nginx or uwsgi when main.py is directly executed.) from wsgiref.simple_server import make_server logfile = os.path.join(LOG_FOLDER, "producer_log.txt") logging.basicConfig(level=logging.INFO, filename=logfile, format='%(levelname)s: %(asctime)s %(message)s') logging.info(f"logging to console and file {logfile}") server = make_server('0.0.0.0', 5000, application) server.serve_forever()
"""Main entrypoint of the Python-based SOAP webapp Here, all required parts of the app are "hooked in". Adapt this file if you want to add new services to this app. """ import logging from spyne.server.wsgi import WsgiApplication from spyne.util.wsgi_wrapper import WsgiMounter import WaiterPrep logging.basicConfig(level=logging.INFO) # We use the wsgi mounter to hook up potentially more than one SOAP service # inside a single app. application = WsgiMounter( {WaiterPrep.SERVICENAME: WsgiApplication(WaiterPrep.create_app())}) if __name__ == '__main__': # Only for debugging! (Will start the app in a simple Python thread # without nginx or uwsgi when main.py is directly executed.) from wsgiref.simple_server import make_server logging.basicConfig(level=logging.INFO) server = make_server('0.0.0.0', 5000, application) server.serve_forever()
ctx.udc = ConfigContext() CreateEventService.event_manager.add_listener('method_call', _on_method_call) BookEventService.event_manager.add_listener('method_call', _on_method_call) OrderPaymentService.event_manager.add_listener('method_call', _on_method_call) CancelOrderService.event_manager.add_listener('method_call', _on_method_call) application_1 = Application([CreateEventService], 'spyne.ticketx.event', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11()) application_2 = Application([CancelOrderService], 'spyne.ticketx.cancel', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11()) application_3 = Application([BookEventService, OrderPaymentService], 'spyne.ticketx.book', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11()) wsgi_application = WsgiMounter({ 'create_event': application_1, 'cancel_order': application_2, 'book_event': application_3 }) if __name__ == '__main__': server = make_server('127.0.0.1', 8000, wsgi_application) print("Serving in 127.0.0.1:8000") server.serve_forever()
"""Main entrypoint of the Python-based SOAP webapp Here, all required parts of the app are "hooked in". Adapt this file if you want to add new services to this app. """ import logging from spyne.server.wsgi import WsgiApplication from spyne.util.wsgi_wrapper import WsgiMounter import PrepWithFile logging.basicConfig(level=logging.INFO) # We use the wsgi mounter to hook up potentially more than one SOAP service # inside a single app. application = WsgiMounter( {PrepWithFile.SERVICENAME: WsgiApplication(PrepWithFile.create_app())}) if __name__ == '__main__': # Only for debugging! (Will start the app in a simple Python thread # without nginx or uwsgi when main.py is directly executed.) from wsgiref.simple_server import make_server logging.basicConfig(level=logging.INFO) server = make_server('0.0.0.0', 5000, application) server.serve_forever()
def main(): global protocols rest = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=HttpRpc()) xml = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=XmlDocument()) soap = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=Soap11()) html = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=HtmlMicroFormat()) png = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=PngClock()) svg = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=SvgClock()) json = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=JsonDocument()) jsoni = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=JsonDocument( ignore_wrappers=True)) jsonl = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=JsonDocument(complex_as=list)) jsonil = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=JsonDocument( ignore_wrappers=True, complex_as=list)) msgpack_doc = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=MessagePackDocument()) msgpack_rpc = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=MessagePackRpc()) yaml = Application([MultiProtService], tns=tns, in_protocol=HttpRpc(), out_protocol=YamlDocument()) dyn = Application([DynProtService], tns=tns, in_protocol=HttpRpc(validator='soft'), out_protocol=HttpRpc()) DynProtService.protocols = { 'json': Tsetprot(JsonDocument(dyn)), 'xml': Tsetprot(XmlDocument(dyn)), 'yaml': Tsetprot(YamlDocument(dyn)), 'soap': Tsetprot(Soap11(dyn)), 'html': Tsetprot(HtmlMicroFormat(dyn)), 'png': Tsetprot(PngClock(dyn)), 'svg': Tsetprot(SvgClock(dyn)), 'msgpack': Tsetprot(MessagePackDocument(dyn)), } root = WsgiMounter({ 'rest': rest, 'xml': xml, 'soap': soap, 'html': html, 'png': png, 'svg': svg, 'json': json, 'jsoni': jsoni, 'jsonl': jsonl, 'jsonil': jsonil, 'mpd': msgpack_doc, 'mprpc': msgpack_rpc, 'yaml': yaml, 'dyn': dyn, }) from wsgiref.simple_server import make_server server = make_server(host, port, root) logging.basicConfig(level=logging.DEBUG) logging.info("listening to http://%s:%d" % (host, port)) logging.info("navigate to e.g. http://%s:%d/json2/get_utc_time" % (host, port)) logging.info(" or: http://%s:%d/xml/get_utc_time" % (host, port)) return server.serve_forever()
in_protocol=HttpRpc(), out_protocol=MessagePackDocument()) msgpack_rpc = Application([HelloWorldService], tns=tns, in_protocol=HttpRpc(), out_protocol=MessagePackRpc()) root = WsgiMounter({ 'rest': rest, 'xml': xml, 'soap': soap, 'html': html, 'png': png, 'svg': svg, 'json': json0, 'json0': json0, 'json1': json1, 'json2': json2, 'json3': json3, 'mpo': msgpack_object, 'mprpc': msgpack_rpc, }) from wsgiref.simple_server import make_server server = make_server(host, port, root) logging.basicConfig(level=logging.DEBUG) logging.info("listening to http://%s:%d" % (host, port)) server.serve_forever()
"""Main entrypoint of the Python-based SOAP webapp Here, all required parts of the app are "hooked in". Adapt this file if you want to add new services to this app. """ import logging from spyne.server.wsgi import WsgiApplication from spyne.util.wsgi_wrapper import WsgiMounter import Dialog logging.basicConfig(level=logging.INFO) # We use the wsgi mounter to hook up potentially more than one SOAP service # inside a single app. application = WsgiMounter( {Dialog.SERVICENAME: WsgiApplication(Dialog.create_app())}) if __name__ == '__main__': # Only for debugging! (Will start the app in a simple Python thread # without nginx or uwsgi when main.py is directly executed.) from wsgiref.simple_server import make_server logging.basicConfig(level=logging.INFO) server = make_server('0.0.0.0', 5000, application) server.serve_forever()
# Convert xls html page specification to dictionary xlsDict = utl.xls2Dict(xlsFileDir) logging.info( 'Constructing web page components from specified input parameters and layout' ) # Save page footer, body and header in specified file names htmlUtl.getPage(pageConfigDir, xlsDict, 'pageHeader.dat', 'pageBody.dat', 'pageFooter.dat') logging.info('Instantiating GUI Application') # Prepare GUI application for gui components guiSrvc.return_type_tuple = tuple([Unicode] + srvcUtl.getTypesList(xlsDict)) guiSrvc.return_names_tuple = tuple(['status_base64'] + srvcUtl.getOutputNamesList(xlsDict)) guiSrvc.standard_vals_list = srvcUtl.getStandardValsList(xlsDict) # Import GUI application and instantiate app import GUIAppService as GUIApp GUIApp.TNS = os.environ['TNS'] application = WsgiMounter( {os.environ['SERVICE_NAME']: WsgiApplication(GUIApp.create_app())}) if __name__ == '__main__': # Start the web service run_simple(location, int(port), application, use_reloader=False)
"""Main entrypoint of the Python-based SOAP webapp Here, all required parts of the app are "hooked in". Adapt this file if you want to add new services to this app. """ import logging from spyne.server.wsgi import WsgiApplication from spyne.util.wsgi_wrapper import WsgiMounter import KafkaConsumerService logging.basicConfig(level=logging.DEBUG) # We use the wsgi mounter to hook up potentially more than one SOAP service # inside a single app. app1 = WsgiApplication(KafkaConsumerService.create_app()) app1.doc.wsdl11.build_interface_document( "https://srv.hetcomp.org/demo-kafka-consumer/KafkaConsumerService") application = WsgiMounter({KafkaConsumerService.SERVICENAME: app1}) if __name__ == '__main__': # Only for debugging! (Will start the app in a simple Python thread # without nginx or uwsgi when main.py is directly executed.) from wsgiref.simple_server import make_server logging.basicConfig(level=logging.DEBUG) server = make_server('0.0.0.0', 5000, application) server.serve_forever()
"""Main entrypoint of the Python-based SOAP webapp Here, all required parts of the app are "hooked in". Adapt this file if you want to add new services to this app. """ import logging from spyne.server.wsgi import WsgiApplication from spyne.util.wsgi_wrapper import WsgiMounter import Debugger logging.basicConfig(level=logging.INFO) # We use the wsgi mounter to hook up potentially more than one SOAP service # inside a single app. application = WsgiMounter( {Debugger.SERVICENAME: WsgiApplication(Debugger.create_app())}) if __name__ == '__main__': # Only for debugging! (Will start the app in a simple Python thread # without nginx or uwsgi when main.py is directly executed.) from wsgiref.simple_server import make_server logging.basicConfig(level=logging.INFO) server = make_server('0.0.0.0', 5000, application) server.serve_forever()
in_protocol=HttpRpc(), out_protocol=MessagePackRpc()) yaml = Application([HelloWorldService], tns=tns, in_protocol=HttpRpc(), out_protocol=YamlDocument()) root = WsgiMounter({ 'rest': rest, 'xml': xml, 'soap': soap, 'html': html, 'png': png, 'svg': svg, 'json': json, 'jsoni': jsoni, 'jsonl': jsonl, 'jsonil': jsonil, 'mpd': msgpack_doc, 'mprpc': msgpack_rpc, 'yaml': yaml, }) from wsgiref.simple_server import make_server server = make_server(host, port, root) logging.basicConfig(level=logging.DEBUG) logging.info("listening to http://%s:%d" % (host, port)) logging.info("navigate to e.g. http://%s:%d/json2/get_utc_time" % (host, port))
"""Main entrypoint of the Python-based SOAP webapp Here, all required parts of the app are "hooked in". Adapt this file if you want to add new services to this app. """ import logging from spyne.server.wsgi import WsgiApplication from spyne.util.wsgi_wrapper import WsgiMounter import Calculator logging.basicConfig(level=logging.INFO) # We use the wsgi mounter to hook up potentially more than one SOAP service # inside a single app. application = WsgiMounter( {Calculator.SERVICENAME: WsgiApplication(Calculator.create_app())}) if __name__ == '__main__': # Only for debugging! (Will start the app in a simple Python thread # without nginx or uwsgi when main.py is directly executed.) from wsgiref.simple_server import make_server logging.basicConfig(level=logging.INFO) server = make_server('0.0.0.0', 5000, application) server.serve_forever()
soap_application = s.create_soap_application() json_application = s.create_json_application() jsonp_application = s.create_jsonp_application() http_application = s.create_http_application() apps = { config.get('hydra_server', 'soap_path', 'soap'): soap_application, config.get('hydra_server', 'json_path', 'json'): json_application, 'jsonp': jsonp_application, config.get('hydra_server', 'http_path', 'http'): http_application, } if ui_app is not None: apps[''] = ui_app wsgi_application = WsgiMounter(apps) for server in wsgi_application.mounts.values(): server.max_content_length = 100 * 0x100000 # 10 MB # Configure the SessionMiddleware session_opts = { 'session.type': 'file', 'session.cookie_expires': True, 'session.data_dir': '/tmp', 'session.file_dir': '/tmp/auth', } application = SessionMiddleware(wsgi_application, session_opts) #To kill this process, use this command: #ps -ef | grep 'server.py' | grep 'python' | awk '{print $2}' | xargs kill
# hw = Application([HelloWorldService], 'spyne.examples.hello.soap', # in_protocol=Soap11(validator='lxml'), # out_protocol=Soap11()) # # from spyne.util.xml import get_schema_documents # docs = get_schema_documents([ResponseMessageType]) # print(docs) # doc = docs['tns'] # print(doc) # pprint.pprint(etree.tostring(doc, pretty_print=True)) # # print(ResponseMessageType.resolve_namespace(ResponseMessageType, __name__)) wsgi_app_get_sub = WsgiMounter({ 'getDevices': getDevices, # 'getDERGroups': getDERGroups, 'queryDERGroups': queryDERGroups, 'queryDERGroupStatuses': queryDERGroupStatuses }) wsgi_app = WsgiMounter({ 'get': wsgi_app_get_sub, 'create': WsgiMounter({'executeDERGroups': createDERGroups}), 'change': WsgiMounter({'executeDERGroups': executeDERGroups}) }) # application = Application( # services=[ExecuteDERGroupsService, ExecuteDERGroupsService1], # tns='http://127.0.0.1:8000',