当前位置: 首页>>代码示例>>Python>>正文


Python MultiRef.process方法代码示例

本文整理汇总了Python中suds.bindings.multiref.MultiRef.process方法的典型用法代码示例。如果您正苦于以下问题:Python MultiRef.process方法的具体用法?Python MultiRef.process怎么用?Python MultiRef.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在suds.bindings.multiref.MultiRef的用法示例。


在下文中一共展示了MultiRef.process方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from suds.bindings.multiref import MultiRef [as 别名]
# 或者: from suds.bindings.multiref.MultiRef import process [as 别名]
class Binding:
    """
    The soap binding class used to process outgoing and imcoming
    soap messages per the WSDL port binding.
    @cvar replyfilter: The reply filter function.
    @type replyfilter: (lambda s,r: r)
    @ivar wsdl: The wsdl.
    @type wsdl: L{suds.wsdl.Definitions}
    @ivar schema: The collective schema contained within the wsdl.
    @type schema: L{xsd.schema.Schema}
    @ivar options: A dictionary options.
    @type options: L{Options}
    """
    
    replyfilter = (lambda s,r: r)

    def __init__(self, wsdl):
        """
        @param wsdl: A wsdl.
        @type wsdl: L{wsdl.Definitions}
        """
        self.wsdl = wsdl
        self.multiref = MultiRef()
        
    def schema(self):
        return self.wsdl.schema
    
    def options(self):
        return self.wsdl.options
        
    def unmarshaller(self, typed=True):
        """
        Get the appropriate XML decoder.
        @return: Either the (basic|typed) unmarshaller.
        @rtype: L{UmxTyped}
        """
        if typed:
            return UmxTyped(self.schema())
        else:
            return UmxBasic()
        
    def marshaller(self):
        """
        Get the appropriate XML encoder.
        @return: An L{MxLiteral} marshaller.
        @rtype: L{MxLiteral}
        """
        return MxLiteral(self.schema(), self.options().xstq)
    
    def param_defs(self, method):
        """
        Get parameter definitions.  
        Each I{pdef} is a tuple (I{name}, L{xsd.sxbase.SchemaObject})
        @param method: A servic emethod.
        @type method: I{service.Method}
        @return: A collection of parameter definitions
        @rtype: [I{pdef},..]
        """
        raise Exception, 'not implemented'

    def get_message(self, method, args, kwargs):
        """
        Get the soap message for the specified method, args and soapheaders.
        This is the entry point for creating the outbound soap message.
        @param method: The method being invoked.
        @type method: I{service.Method}
        @param args: A list of args for the method invoked.
        @type args: list
        @param kwargs: Named (keyword) args for the method invoked.
        @type kwargs: dict
        @return: The soap envelope.
        @rtype: L{Document}
        """

        content = self.headercontent(method)
        header = self.header(content)
        content = self.bodycontent(method, args, kwargs)
        body = self.body(content)
        env = self.envelope(header, body)
        if self.options().prefixes:
            body.normalizePrefixes()
            env.promotePrefixes()
        else:
            env.refitPrefixes()
        return Document(env)
    
    def get_reply(self, method, reply):
        """
        Process the I{reply} for the specified I{method} by sax parsing the I{reply}
        and then unmarshalling into python object(s).
        @param method: The name of the invoked method.
        @type method: str
        @param reply: The reply XML received after invoking the specified method.
        @type reply: str
        @return: The unmarshalled reply.  The returned value is an L{Object} for a
            I{list} depending on whether the service returns a single object or a 
            collection.
        @rtype: tuple ( L{Element}, L{Object} )
        """
        reply = self.replyfilter(reply)
#.........这里部分代码省略.........
开发者ID:propars,项目名称:python-suds,代码行数:103,代码来源:binding.py

示例2: Binding

# 需要导入模块: from suds.bindings.multiref import MultiRef [as 别名]
# 或者: from suds.bindings.multiref.MultiRef import process [as 别名]
class Binding(object):
    """
    The SOAP binding class used to process outgoing and incoming SOAP messages
    per the WSDL port binding.

    @ivar wsdl: The WSDL.
    @type wsdl: L{suds.wsdl.Definitions}
    @ivar schema: The collective schema contained within the WSDL.
    @type schema: L{xsd.schema.Schema}
    @ivar options: A dictionary options.
    @type options: L{Options}

    """

    def __init__(self, wsdl):
        """
        @param wsdl: A WSDL.
        @type wsdl: L{wsdl.Definitions}

        """
        self.wsdl = wsdl
        self.multiref = MultiRef()

    def schema(self):
        return self.wsdl.schema

    def options(self):
        return self.wsdl.options

    def unmarshaller(self):
        """
        Get the appropriate schema based XML decoder.

        @return: Typed unmarshaller.
        @rtype: L{UmxTyped}

        """
        return UmxTyped(self.schema())

    def marshaller(self):
        """
        Get the appropriate XML encoder.

        @return: An L{MxLiteral} marshaller.
        @rtype: L{MxLiteral}

        """
        return MxLiteral(self.schema(), self.options().xstq)

    def param_defs(self, method):
        """
        Get parameter definitions.

        Each I{pdef} is a (I{name}, L{xsd.sxbase.SchemaObject}) tuple.

        @param method: A service method.
        @type method: I{service.Method}
        @return: A collection of parameter definitions
        @rtype: [I{pdef},...]

        """
        raise Exception("not implemented")

    def get_message(self, method, args, kwargs):
        """
        Get a SOAP message for the specified method, args and SOAP headers.

        This is the entry point for creating an outbound SOAP message.

        @param method: The method being invoked.
        @type method: I{service.Method}
        @param args: A list of args for the method invoked.
        @type args: list
        @param kwargs: Named (keyword) args for the method invoked.
        @type kwargs: dict
        @return: The SOAP envelope.
        @rtype: L{Document}

        """
        content = self.headercontent(method)
        header = self.header(content)
        content = self.bodycontent(method, args, kwargs)
        body = self.body(content)
        env = self.envelope(header, body)
        if self.options().prefixes:
            body.normalizePrefixes()
            env.promotePrefixes()
        else:
            env.refitPrefixes()
        return Document(env)

    def get_reply(self, method, replyroot):
        """
        Process the I{reply} for the specified I{method} by unmarshalling it
        into into Python object(s).

        @param method: The name of the invoked method.
        @type method: str
        @param replyroot: The reply XML root node received after invoking the
            specified method.
#.........这里部分代码省略.........
开发者ID:EASYMARKETING,项目名称:suds-jurko,代码行数:103,代码来源:binding.py


注:本文中的suds.bindings.multiref.MultiRef.process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。