def run(): from wsgiref.simple_server import make_server logging.basicConfig(level=logging.DEBUG) logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:8000") logging.info("wsdl is at: http://localhost:8000/?wsdl") wsgi_app = wsgi_soap_application([Authentication], 'http://vitalstream.com/webservices', name='AuthenticationSoap') server = make_server('127.0.0.1', 8000, wsgi_app) server.serve_forever()
"Hello, punk", } >>> ''' class HelloWorldService(ServiceBase): @srpc(Unicode, Integer, _returns=Iterable(Unicode)) def say_hello(name, times): ''' Docstrings for service methods appear as documentation in the wsdl <b>what fun</b> @param name the name to say hello to @param the number of times to say hello @return the completed array ''' for i in range(times): yield u'Hello, %s' % name if __name__=='__main__': logging.basicConfig(level=logging.DEBUG) logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:7789") logging.info("wsdl is at: http://localhost:7789/?wsdl") wsgi_app = wsgi_soap_application([HelloWorldService], 'spyne.examples.hello.soap') server = make_server('127.0.0.1', 7789, wsgi_app) server.serve_forever()
from spyne.util.simple import wsgi_soap_application class HelloWorldService(ServiceBase): @rpc(Unicode, _returns=Iterable(Unicode), _body_style='bare') def say_hello(ctx, name): """ Docstrings for service methods appear as documentation in the wsdl <b>what fun</b> @param name the name to say hello to @param the number of times to say hello @return the completed array """ return u'Hello, %s' % name if __name__ == '__main__': from wsgiref.simple_server import make_server logging.basicConfig(level=logging.DEBUG) logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:8000") logging.info("wsdl is at: http://localhost:8000/?wsdl") wsgi_app = wsgi_soap_application([HelloWorldService], 'spyne.examples.hello.soap') server = make_server('127.0.0.1', 8000, wsgi_app) server.serve_forever()
return "0" @srpc(Unicode, Unicode, Unicode, Unicode, _returns=String) def getAntennaNameAssignedToPad(steName, configurationName, startupName, padname): if configurationName.__contains__("SUCCESS"): return "1" else: return "0" @srpc(Unicode, Unicode, Unicode, _returns=String) def getConfiguredAntennas(steName, configurationName, startupName): if configurationName.__contains__("SUCCESS"): return "1" else: return "0" @srpc(Unicode, Unicode, Unicode, Unicode, _returns=String) def isComputerDeployed(steName, configurationName, startupName, computername): if configurationName.__contains__("SUCCESS"): return "1" else: return "0" if __name__=='__main__': logging.basicConfig(level=logging.DEBUG) logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:7790") logging.info("wsdl is at: http://localhost:7790/?wsdl") wsgi_app = wsgi_soap_application([STEDeploymentInfo], 'cl.alma.adc.webservice.soap') server = make_server('127.0.0.1', 7790, wsgi_app) server.serve_forever()
#query the messages collection based on the datetime try: messages = [message['event'] for message in message_collection.find({"received": {"$gt": datetime}})] return messages except PyMongoError as e: logging.error('An error occurred whilst querying the database: %s'% e) return [] if __name__=='__main__': connection = Connection() database = connection.rmas_messages message_collection = database.message_collection logging.basicConfig(level=logging.INFO) logging.getLogger('spyne.protocol.xml').setLevel(logging.INFO) logging.info("listening to http://127.0.0.1:7789") logging.info("wsdl is at: http://localhost:7789/?wsdl") wsgi_app = wsgi_soap_application([RMASService], 'spyne.examples.hello.soap') server = make_server('127.0.0.1', 7789, wsgi_app) server.serve_forever()
import os from spyne.decorator import srpc from spyne.service import ServiceBase from spyne.model.complex import ComplexModel from spyne.model.complex import Iterable from spyne.model.primitive import Float from spyne.model.primitive import Unicode from spyne.util.simple import wsgi_soap_application class DeliveryFeesService(ServiceBase): @srpc(Float, Float, _returns=Float) def compute_fees(distance, weight): return distance * weight * 0.1 if __name__ == '__main__': from wsgiref.simple_server import make_server logging.basicConfig(level=logging.DEBUG) logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG) port = os.environ['PORT'] logging.info('Binding to port : ' + str(port)) wsgi_app = wsgi_soap_application([DeliveryFeesService], 'com.marketplace.delivery') server = make_server('0.0.0.0', int(port), wsgi_app) server.serve_forever()
return "1" else: return "0" @srpc(Unicode, Unicode, Unicode, Unicode, Unicode, _returns=String) def setLkmLoaderInXml(steName, configurationName, startupName, antennaName, lkmFile): if steName.__contains__("SUCCESS"): return "1" else: return "0" @srpc(Unicode, Unicode, Unicode, Unicode, _returns=String) def setIPInXml(steName, configurationName, startupName, antennaName): if steName.__contains__("SUCCESS"): return "1" else: return "0" if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) logging.getLogger("spyne.protocol.xml").setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:7789") logging.info("wsdl is at: http://localhost:7789/?wsdl") wsgi_app = wsgi_soap_application([STEDeploymentConfigurator], "cl.alma.adc.webservice.soap") server = make_server("10.197.53.110", 7789, wsgi_app) # server = make_server('127.0.0.1', 7789, wsgi_app) server.serve_forever()