本文整理汇总了Python中pysimplesoap.server.SoapDispatcher.wsdl方法的典型用法代码示例。如果您正苦于以下问题:Python SoapDispatcher.wsdl方法的具体用法?Python SoapDispatcher.wsdl怎么用?Python SoapDispatcher.wsdl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysimplesoap.server.SoapDispatcher
的用法示例。
在下文中一共展示了SoapDispatcher.wsdl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: soap
# 需要导入模块: from pysimplesoap.server import SoapDispatcher [as 别名]
# 或者: from pysimplesoap.server.SoapDispatcher import wsdl [as 别名]
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