Example #1
0
 def process(self, content):
     """
     Process (marshal) the tag with the specified value using the
     optional type information.
     @param content: The content to process.
     @type content: L{Object}
     """
     log.debug('processing:\n%s', content)
     self.reset()
     if content.tag is None:
         content.tag = content.value.__class__.__name__
     document = Document()
     self.append(document, content)
     return document.root()
Example #2
0
 def process(self, content):
     """
     Process (marshal) the tag with the specified value using the
     optional type information.
     @param content: The content to process.
     @type content: L{Object}
     """
     log.debug('processing:\n%s', content)
     self.reset()
     if content.tag is None:
         content.tag = content.value.__class__.__name__
     document = Document()
     self.append(document, content)
     return document.root()
Example #3
0
    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)
Example #4
0
    def write_reply(self, method, obj):
        """
        Get the soap reply message for the specified method and object.
        @param method: The method being invoked.
        @type method: I{service.Method}
        @param obj: Response object
        @type obj: I{sudsobject}
        @return: The soap envelope.
        @rtype: L{Document}
        """

        content = self.headercontent(method)
        header = self.header(content)

        element = method.soap.output.body.parts[0].element
        pd = self.wsdl.schema.elements[element]

        content = self.mkparam(method, (element[0], pd), obj)
        body = self.body(content)
        env = self.envelope(header, body)
        if self.options().prefixes:
            body.normalizePrefixes()
            env.promotePrefixes()
        else:
            env.refitPrefixes()
        return Document(env)
Example #5
0
    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()
        if method.soap.version == 'SOAP12':
            env.replaceUri(envns[1], 'http://www.w3.org/2003/05/soap-envelope')
        return Document(env)
Example #6
0
 def __init__(self):
     self.nodes = [Document()]