Beispiel #1
0
    def operation(self, name, input_name=None, output_name=None):
        """
        Shortcut used to get a contained operation by name.
        @param name: An operation name.
        @param input_name: Input message name, used for resolution of overloaded methods
        @param output_name: Output message name, used for resolution of overloaded methods
        @type name: str
        @return: The named operation.
        @rtype: Operation
        @raise L{MethodNotFound}: When not found.
        """
        try:
            ops = self.operations[name]
        except Exception:
            raise MethodNotFound(name)

        if len(ops) == 1:
            return ops[0]
        elif input_name is not None and output_name is not None:
            for op in ops:
                if op.input.name == input_name and op.output.name == output_name:
                    return op
            raise Exception(
                "operation '%s' is defined multiple times in portType and input/output names do not match to any of them"
                % name)
        else:
            raise Exception(
                "operation '%s' is defined multiple times in portType and input/output names are not provided"
                % name)
Beispiel #2
0
 def returning_message(self, output_name):
     methods = [
         m for m in self.methods if m.soap.output.name == output_name
     ]
     if not methods:
         raise MethodNotFound(self.methods[0].name,
                              "returning message '%s'" % output_name)
     return Method(self.client, methods)
Beispiel #3
0
 def __methods_accepting_args(self, arg_names):
     methods = [
         m for m in self.methods
         if Method.__part_names(m).issuperset(arg_names)
     ]
     if not methods:
         raise MethodNotFound(
             self.methods[0].name,
             "accepting arguments: '%s'" % "', '".join(arg_names))
     return methods
Beispiel #4
0
    def method(self, name, input_name=None, output_name=None):
        """
        Get a method defined in this portType by name.
        @param name: A method name.
        @param input_name: Method's input name, used for resolution of overloaded methods
        @param output_name: Method's output name, used for resolution of overloaded methods
        @type name: str
        @return: The requested method object.
        @rtype: I{Method}
        """
        methods = self.methods.get(name)
        if methods is None:
            raise MethodNotFound(name)
        elif len(methods) == 1:
            return methods[0]
        elif input_name is not None and output_name is not None:
            for m in methods:
                if m.soap.input.name == input_name and m.soap.output.name == output_name:
                    return m

        return MethodNotFound(name)
Beispiel #5
0
 def operation(self, name):
     """
     Shortcut used to get a contained operation by name.
     @param name: An operation name.
     @type name: str
     @return: The named operation.
     @rtype: Operation
     @raise L{MethodNotFound}: When not found.
     """
     try:
         return self.operations[name]
     except:
         raise MethodNotFound(name)
Beispiel #6
0
 def __getitem__(self, name):
     """
     Get a method by name and return it in an I{execution wrapper}.
     @param name: The name of a method.
     @type name: str
     @return: An I{execution wrapper} for the specified method name.
     @rtype: L{Method}
     """
     m = self.__methods.get(name)
     if m is None:
         qn = '.'.join((self.__qn, name))
         raise MethodNotFound(qn)
     return Method(self.__client, m)
Beispiel #7
0
    def operation(self, name, input_name=None, output_name=None):
        """
        Shortcut used to get a contained operation by name.
        @param name: An operation name.
        @param input_name: Operation input name, used for resolution of overloaded operations
        @param output_name: Operation output name, used for resolution of overloaded operations
        @type name: str
        @return: The named operation.
        @rtype: Operation
        @raise L{MethodNotFound}: When not found.
        """
        try:
            ops = self.operations[name]
        except:
            raise MethodNotFound(name)

        if len(ops) == 1:
            return ops[0]
        elif input_name is not None and output_name is not None:
            for op in ops:
                if op.soap.input.name == input_name and op.soap.output.name == output_name:
                    return op

        raise MethodNotFound(name)
Beispiel #8
0
 def accepting_message(self, input_name):
     methods = [m for m in self.methods if m.soap.input.name == input_name]
     if not methods:
         raise MethodNotFound(self.methods[0].name,
                              "accepting message '%s'" % input_name)
     return Method(self.client, methods)