本文整理匯總了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