本文整理汇总了Python中pysimplesoap.server.SoapDispatcher类的典型用法代码示例。如果您正苦于以下问题:Python SoapDispatcher类的具体用法?Python SoapDispatcher怎么用?Python SoapDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoapDispatcher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
dispatcher = SoapDispatcher('op_adapter_soap_disp', location = self.address, action = self.address,
namespace = "http://smartylab.co.kr/products/op/adapter", prefix="tns", trace = True, ns = True)
dispatcher.register_function('adapt', self.adapt, returns={'out': str},
args={'nodeID': str, 'resourceName': str, 'duration': str, 'options': str})
print("Starting a SOAP server for adapter layer of OP...")
httpd = HTTPServer(("", 8008), SOAPHandler)
httpd.dispatcher = dispatcher
httpd.serve_forever()
开发者ID:dykim723,项目名称:robot-yujin,代码行数:9,代码来源:server.py
示例2: soap
def soap(self):
from pysimplesoap.server import SoapDispatcher
import uliweb.contrib.soap as soap
from uliweb.utils.common import import_attr
from uliweb import application as app, response, url_for
from functools import partial
global __soap_dispatcher__
if not __soap_dispatcher__:
location = "%s://%s%s" % (
request.environ['wsgi.url_scheme'],
request.environ['HTTP_HOST'],
request.path)
namespace = functions.get_var(self.config).get('namespace') or location
documentation = functions.get_var(self.config).get('documentation')
dispatcher = SoapDispatcher(
name = functions.get_var(self.config).get('name'),
location = location,
action = '', # SOAPAction
namespace = namespace,
prefix=functions.get_var(self.config).get('prefix'),
documentation = documentation,
exception_handler = partial(exception_handler, response=response),
ns = True)
for name, (func, returns, args, doc) in soap.__soap_functions__.get(self.config, {}).items():
if isinstance(func, (str, unicode)):
func = import_attr(func)
dispatcher.register_function(name, func, returns, args, doc)
else:
dispatcher = __soap_dispatcher__
if 'wsdl' in request.GET:
# Return Web Service Description
response.headers['Content-Type'] = 'text/xml'
response.write(dispatcher.wsdl())
return response
elif request.method == 'POST':
def _call(func, args):
rule = SimpleRule()
rule.endpoint = func
mod, handler_cls, handler = app.prepare_request(request, rule)
result = app.call_view(mod, handler_cls, handler, request, response, _wrap_result, kwargs=args)
r = _fix_soap_datatype(result)
return r
# Process normal Soap Operation
response.headers['Content-Type'] = 'text/xml'
log.debug("---request message---")
log.debug(request.data)
result = dispatcher.dispatch(request.data, call_function=_call)
log.debug("---response message---")
log.debug(result)
response.write(result)
return response
开发者ID:08haozi,项目名称:uliweb,代码行数:54,代码来源:views.py
示例3: main
def main():
dispatcher = SoapDispatcher(
'my_dispatcher',
location='http://'+host+':8888/',
action='http://'+host+'8888/',
namespace='http://security.com/security_sort.wsdl', prefix='ns0',trace=True,ns=True)
dispatcher.register_function('Security', show_security, returns={'resp': unicode}, args={'datas': security()})
handler = WSGISOAPHandler(dispatcher)
wsgi_app = tornado.wsgi.WSGIContainer(handler)
tornado_app = tornado.web.Application([('.*', tornado.web.FallbackHandler, dict(fallback=wsgi_app)),])
server = tornado.httpserver.HTTPServer(tornado_app)
server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
开发者ID:Secure-Shell-Sister,项目名称:SOAP,代码行数:13,代码来源:server.py
示例4: test_multi_ns
def test_multi_ns(self):
dispatcher = SoapDispatcher(
name = "MTClientWS",
location = "http://localhost:8008/ws/MTClientWS",
action = 'http://localhost:8008/ws/MTClientWS', # SOAPAction
namespace = "http://external.mt.moboperator", prefix="external",
documentation = 'moboperator MTClientWS',
namespaces = {
'external': 'http://external.mt.moboperator',
'model': 'http://model.common.mt.moboperator'
},
ns = True,
pretty=False,
debug=True)
dispatcher.register_function('activateSubscriptions',
self._multi_ns_func,
returns=self._multi_ns_func.returns,
args=self._multi_ns_func.args)
dispatcher.register_function('updateDeliveryStatus',
self._updateDeliveryStatus,
returns=self._updateDeliveryStatus.returns,
args=self._updateDeliveryStatus.args)
self.assertEqual(dispatcher.dispatch(REQ), MULTI_NS_RESP)
self.assertEqual(dispatcher.dispatch(REQ1), MULTI_NS_RESP1)
开发者ID:KongJustin,项目名称:pysimplesoap,代码行数:26,代码来源:server_multins_test.py
示例5: test_single_ns
def test_single_ns(self):
dispatcher = SoapDispatcher(
name = "MTClientWS",
location = "http://localhost:8008/ws/MTClientWS",
action = 'http://localhost:8008/ws/MTClientWS', # SOAPAction
namespace = "http://external.mt.moboperator", prefix="external",
documentation = 'moboperator MTClientWS',
ns = True,
pretty=False,
debug=True)
dispatcher.register_function('activateSubscriptions',
self._single_ns_func,
returns=self._single_ns_func.returns,
args=self._single_ns_func.args)
# I don't fully know if that is a valid response for a given request,
# but I tested it, to be sure that a multi namespace function
# doesn't brake anything.
self.assertEqual(dispatcher.dispatch(REQ), SINGLE_NS_RESP)
开发者ID:KongJustin,项目名称:pysimplesoap,代码行数:20,代码来源:server_multins_test.py
示例6: init_service
def init_service(port, servicename, userfunction, args, returns):
# define service
dispatcher = SoapDispatcher(
servicename,
location="http://localhost:%d/" % (port,),
action="http://localhost:%d/" % (port,), # SOAPAction
namespace="http://example.com/%s.wsdl" % (servicename,),
prefix="ns0",
trace=True,
ns=True,
)
# register the user function
dispatcher.register_function(servicename, userfunction, returns=returns, args=args)
# start service
print("Starting server '%s' on port %i ..." % (servicename, port))
httpd = HTTPServer(("", port), SOAPHandler)
httpd.dispatcher = dispatcher
httpd.serve_forever()
开发者ID:dcherix,项目名称:apiontology-demonstrator,代码行数:20,代码来源:service.py
示例7: TestSoapDispatcher
class TestSoapDispatcher(unittest.TestCase):
def setUp(self):
self.disp = SoapDispatcher(
name="PySimpleSoapSample",
location="http://localhost:8008/",
action='http://localhost:8008/', # SOAPAction
namespace="http://example.com/pysimplesoapsamle/", prefix="ns0",
documentation='Example soap service using PySimpleSoap',
debug=True,
ns=True)
self.disp.register_function('dummy', dummy,
returns={'out0': str},
args={'in0': str}
)
self.disp.register_function('dummy_response_element', dummy,
returns={'out0': str},
args={'in0': str},
response_element_name='diffRespElemName'
)
def test_zero(self):
response = """<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><dummyResponse xmlns="http://example.com/pysimplesoapsamle/"><out0>Hello world</out0></dummyResponse></soap:Body></soap:Envelope>"""
request = """\
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<dummy xmlns="http://example.com/sample.wsdl">
<in0 xsi:type="xsd:string">Hello world</in0>
</dummy>
</soap:Body>
</soap:Envelope>"""
self.assertEqual(self.disp.dispatch(request), response)
def test_response_element_name(self):
response = """<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><diffRespElemName xmlns="http://example.com/pysimplesoapsamle/"><out0>Hello world</out0></diffRespElemName></soap:Body></soap:Envelope>"""
request = """\
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<dummy_response_element xmlns="http://example.com/sample.wsdl">
<in0 xsi:type="xsd:string">Hello world</in0>
</dummy_response_element>
</soap:Body>
</soap:Envelope>"""
self.assertEqual(self.disp.dispatch(request), response)
开发者ID:n1k9,项目名称:pysimplesoap,代码行数:52,代码来源:soapdispatcher_test2.py
示例8: setUp
def setUp(self):
self.disp = SoapDispatcher(
name="PySimpleSoapSample",
location="http://localhost:8008/",
action='http://localhost:8008/', # SOAPAction
namespace="http://example.com/pysimplesoapsamle/", prefix="ns0",
documentation='Example soap service using PySimpleSoap',
debug=True,
ns=True)
self.disp.register_function('dummy', dummy,
returns={'out0': str},
args={'in0': str}
)
self.disp.register_function('dummy_response_element', dummy,
returns={'out0': str},
args={'in0': str},
response_element_name='diffRespElemName'
)
开发者ID:n1k9,项目名称:pysimplesoap,代码行数:19,代码来源:soapdispatcher_test2.py
示例9: setUp
def setUp(self):
self.dispatcher = SoapDispatcher(
name="PySimpleSoapSample",
location="http://localhost:8008/",
action='http://localhost:8008/', # SOAPAction
namespace="http://example.com/pysimplesoapsamle/", prefix="ns0",
documentation='Example soap service using PySimpleSoap',
debug=True,
ns=True)
self.dispatcher.register_function('Adder', adder,
returns={'AddResult': {'ab': int, 'dd': str}},
args={'p': {'a': int, 'b': int}, 'dt': Date, 'c': [{'d': Decimal}]})
self.dispatcher.register_function('Dummy', dummy,
returns={'out0': str},
args={'in0': str})
self.dispatcher.register_function('Echo', echo)
开发者ID:JAVTAMVI,项目名称:pysimplesoap,代码行数:19,代码来源:soapdispatcher_test.py
示例10: get_wsapplication
def get_wsapplication():
dispatcher = SoapDispatcher(
'thunder_counter_dispatcher',
location = str(gConfig['webservice']['location']),
action = str(gConfig['webservice']['action']),
namespace = str(gConfig['webservice']['namespace']),
prefix = str(gConfig['webservice']['prefix']),
trace = True,
ns = True)
dispatcher.register_function('login',
webservice_login,
returns={'Result': str},
args={'username': str, 'password': str})
dispatcher.register_function('GetFlashofDate',
webservice_GetFlashofDate,
returns={'Result': str},
args={'in0': str, 'in1': str})
dispatcher.register_function('GetFlashofEnvelope',
webservice_GetFlashofEnvelope,
returns={'Result': str},
args={'in0': str, 'in1': str, 'in2': str,'in3': str, 'in4': str, 'in5': str})
wsapplication = WSGISOAPHandler(dispatcher)
return wsapplication
开发者ID:kamijawa,项目名称:ogc_server,代码行数:23,代码来源:soap_server.py
示例11: print
#print(xmlElm.children())
#img = xmlElm.unmarshall({'img':array.array})
print(img)
with open("out\\" + name, 'wb') as f2:
img.tofile(f2)
except Exception as e:
print e
return 0
# If the program is run directly or passed as an argument to the python
# interpreter then create a server instance and show window
if __name__ == "__main__":
dispatcher = SoapDispatcher(
'my_dispatcher',
location = "http://localhost:8008/",
action = 'http://localhost:8008/', # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
# register the user function
dispatcher.register_function('uploadImages', uploadImages,
returns={'Result': int},
args={'imgs_str': str})
dispatcher.register_function('uploadImage', uploadImage,
returns={'Result': int},
args={'name': str, 'imgstr': str})
dispatcher.register_function('uploadConfigAndImages', uploadConfigAndImages,
returns={'Result': int},
开发者ID:stndstn,项目名称:minidsgn,代码行数:31,代码来源:uploadfilessv.py
示例12: _start_soap_server
def _start_soap_server(self):
"""
To launch a SOAP server for the adapter
:return:
"""
dispatcher = SoapDispatcher('concert_adapter_soap_server', location = SOAP_SERVER_ADDRESS, action = SOAP_SERVER_ADDRESS,
namespace = "http://smartylab.co.kr/products/op/adapter", prefix="tns", ns = True)
# To register a method for LinkGraph Service Invocation
dispatcher.register_function('invoke_adapter', self.receive_service_invocation, returns={'out': str},
args={
'LinkGraph': {
'name': str,
'nodes': [{
'Node': {
'id': str,
'uri': str,
'min': int,
'max': int,
'parameters': [{
'parameter': {
'message': str,
'frequency': int
}
}]
}
}],
'topics': [{
'Topic': {
'id': str,
'type': str
}
}],
'actions': [{
'Action': {
'id': str, # action id
'type': str, # action specification
'goal_type': str # goal message type
}
}],
'services': [{
'Service': {
'id': str, # service id
'type': str, # service class
'persistency': str # persistency
}
}],
'edges': [{
'Edge': {
'start': str,
'finish': str,
'remap_from': str,
'remap_to': str
}
}],
'methods': [{
'Method': {
'address': str,
'namespace': str,
'name': str,
'return_name': str,
'param': str
}
}]
}
}
)
# To register a method for Single Node Service Invocation
dispatcher.register_function('send_topic_msg', self._send_topic_msg, returns={'out': str},
args={
'namespace': str,
'message_val': str
}
)
# To register a method for sending Action messages
dispatcher.register_function('send_action_msg', self._send_action_msg, returns={'out': str},
args={
'namespace': str,
'message_val': str
}
)
# To register a method for sending Service messages
dispatcher.register_function('send_service_msg', self._send_service_msg, returns={'out': str},
args={
'namespace': str,
'message_val': str
}
)
# To register a method for Releasing Allocated Resources
dispatcher.register_function('release_allocated_resources', self.release_allocated_resources, returns={'out': bool}, args={})
# To create SOAP Server
rospy.loginfo("Starting a SOAP server...")
self.httpd = HTTPServer(("", int(SOAP_SERVER_PORT)), SOAPHandler)
#.........这里部分代码省略.........
开发者ID:smartylab,项目名称:concert_adapter,代码行数:101,代码来源:adapter_old.py
示例13: len
result_matrix = [0] * (first_matrix_height*second_matrix_width)
for _ in itertools.repeat(None, len(result_matrix)):
index, res = receiveResult()
result_matrix[index] = res
print "%s seconds" % (time.time() - start_time)
return {'result_matrix': result_matrix, 'result_matrix_width': second_matrix_width,
'result_matrix_height': first_matrix_height}
dispatcher = SoapDispatcher(
'multiplyMatrix',
location = "http://localhost:%d/" % SERVER_PORT,
action = "http://localhost:%d/" % SERVER_PORT,
trace = True,
ns = True
)
dispatcher.register_function(
'multiplyMatrix',
multiplyMatrix,
returns = { 'result_matrix': [int], 'result_matrix_width': int, 'result_matrix_height': int },
args = { 'first_matrix': [int], 'first_matrix_width': int, 'first_matrix_height': int,
'second_matrix': [int], 'second_matrix_width': int, 'second_matrix_height': int }
)
httpd = HTTPServer(("", SERVER_PORT), SOAPHandler)
httpd.dispatcher = dispatcher
开发者ID:ivan1993spb,项目名称:py_mpi_matrix_mult,代码行数:29,代码来源:mult_matrix_server.py
示例14: SoapDispatcher
else:
if current_path[-1] != '/':
current_path = current_path + '/'
cur_path = current_path + path
if os.path.isdir(cur_path):
current_path = cur_path
if current_path[-1] != '/':
current_path = current_path + '/'
return True
return False
dispatcher = SoapDispatcher(
'my_dispatcher',
location='http://localhost:8008/',
action='http://localhost:8008/',
namespace='http://example.com/sample.wsdl',
prefix='ns0',
trace=True,
ns=True)
dispatcher.register_function('rm', rm,
returns={'Result': bool},
args={'filename': str})
dispatcher.register_function('cp', cp,
returns={'Result': bool},
args={'src': str, 'dest': str})
dispatcher.register_function('rename', rename,
returns={'Result': bool},
args={'src': str, 'dest': str})
开发者ID:lavenresearch,项目名称:cloudStorageService,代码行数:32,代码来源:server.py
示例15: SoapDispatcher
from pysimplesoap.server import SoapDispatcher, SOAPHandler, WSGISOAPHandler
import logging
import const
from BaseHTTPServer import HTTPServer
dispatcher = SoapDispatcher(
'TransServer',
location = "http://%s:8050/" % const.TARGET_IP,
action = 'http://%s:8050/' % const.TARGET_IP, # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
def on():
return "on"
def off():
return "off"
def status():
return "1024"
# register the user function
dispatcher.register_function('on', on,
args={},
returns={'result': str}
)
dispatcher.register_function('off', off,
args={},
returns={'result': str}
)
开发者ID:Kondziowy,项目名称:rpi-api-examples,代码行数:31,代码来源:http_server_soap.py
示例16: adder
from BaseHTTPServer import HTTPServer
import os.path
import imp
from subprocess import Popen, PIPE, STDOUT,call
def adder(a):
if a == '1':
if os.path.exists('/home/samara/Documentos/TG/TG-Background/Code/run_finger.py'):
p = Popen(["python","/home/samara/Documentos/TG/TG-Background/Code/teste.py"], stdout=PIPE).communicate()[0]
return p
return 'NOT'
return 'NOT'
dispatcher = SoapDispatcher(
'my_dispatcher',
location = "http://localhost:8008/",
action = 'http://localhost:8008/', # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
# register the user function
dispatcher.register_function('Adder', adder,
returns={'result': str},
args={'a': str})
print "Starting server..."
httpd = HTTPServer(("", 8008), SOAPHandler)
httpd.dispatcher = dispatcher
httpd.serve_forever()
开发者ID:SamaraCardoso27,项目名称:TG-Background,代码行数:30,代码来源:webservice.py
示例17: subtractor
def subtractor(a,b):
"Subtract two numbers"
return a-b
def multiplier(a,b):
"Multiply two numbers"
return a*b
def divider(a,b):
"Divide two numbers"
return float(a/b)
dispatcher = SoapDispatcher(
'my_dispatcher',
location = "http://localhost:8008/",
action = 'http://localhost:8008/',
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
# register the user functions
dispatcher.register_function('Add', adder,
returns={'AddResult': int},
args={'a': int,'b': int})
dispatcher.register_function('Sub', subtractor,
returns={'SubResult': int},
args={'a': int,'b': int})
dispatcher.register_function('Mul', multiplier,
returns={'MulResult': int},
开发者ID:SokratisT,项目名称:cp8202,代码行数:31,代码来源:simple_calc_server.py
示例18: adder
def adder(a,b):
"Add two values"
return a+b
def multiplier(a,b):
"Multiply two values"
return a*b
#######################
dispatcher = SoapDispatcher(
'my_dispatcher',
location = "http://localhost:8080/",
action = 'http://localhost:8080/', # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
# register the user function
dispatcher.register_function('Adder', adder,
returns={'AddResult': int},
args={'a': int,'b': int},
doc = 'Add two values...')
dispatcher.register_function('Multiplier', multiplier,
returns={'MultResult': int},
args={'a': int,'b': int},
doc = 'Multiply two values...')
开发者ID:ricleal,项目名称:PythonCode,代码行数:29,代码来源:test3_server.py
示例19: adder
def adder(a,b):
"Add two values"
return a+b
def hello(name):
return "Hello {0}".format(name)
def list_individuos(name):
return ["Eduardo", u"Fábio", "Teste"]
dispatcher = SoapDispatcher(
'my_dispatcher',
location = "http://localhost:8008/",
action = 'http://localhost:8008/', # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
# register the user function
dispatcher.register_function('Adder', adder,
returns={'AddResult': int},
args={'a': int,'b': int})
dispatcher.register_function('Hello', hello,
returns={'Hello': str},
args={'name': str})
开发者ID:eduardocl,项目名称:scripts,代码行数:29,代码来源:soapserver.py
示例20: delete
r.set(key, val)
return success
return "Fail! Record with key \"" + key + "\" was not found!"
def delete(key):
if r.exists(key):
r.delete(key)
return success
return "Fail! Record with key \"" + key + "\" was not found!"
r = redis.StrictRedis(host='localhost', port=6379)
if __name__ == '__main__':
dispatcher = SoapDispatcher(
'di-di-dispatcher',
location="http://localhost:8008/")
dispatcher.register_function("testf", testf, returns={'MultResult': int}, args={'t': int})
dispatcher.register_function("CreateRecord", create, returns={'Result': int}, args={"key": str, "val": str})
dispatcher.register_function("ReadRecord", read, returns={'Result': int}, args={"key": str})
dispatcher.register_function("UpdateRecord", update, returns={'Result': int}, args={"key": str, "val": str})
dispatcher.register_function("DeleteRecord", delete, returns={'Result': int}, args={"key": str})
server_address = ('', 8000)
httpd = HTTPServer(server_address, SOAPHandler)
httpd.dispatcher = dispatcher
httpd.serve_forever()
开发者ID:papaq,项目名称:ComputerArchitecture3,代码行数:30,代码来源:Server.py
注:本文中的pysimplesoap.server.SoapDispatcher类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论