Example #1
0
 def headpart_types(self, method, input=True):
     """
     Get a list of I{parameter definitions} (pdef) defined for the specified method.
     Each I{pdef} is a tuple (I{name}, L{xsd.sxbase.SchemaObject})
     @param method: A service method.
     @type method: I{service.Method}
     @param input: Defines input/output message.
     @type input: boolean
     @return:  A list of parameter definitions
     @rtype: [I{pdef},]
     """
     result = []
     if input:
         headers = method.soap.input.headers
     else:
         headers = method.soap.output.headers
     for header in headers:
         part = header.part
         if part.element is not None:
             query = ElementQuery(part.element)
         else:
             query = TypeQuery(part.type)
         pt = query.execute(self.schema())
         if pt is None:
             raise TypeNotFound(query.ref)
         if part.type is not None:
             pt = PartElement(part.name, pt)
         if input:
             if pt.name is None:
                 result.append((part.name, pt))
             else:
                 result.append((pt.name, pt))
         else:
             result.append(pt)
     return result
Example #2
0
 def set_wrapped(self):
     """ set (wrapped|bare) flag on messages """
     for b in self.bindings.values():
         for op in b.operations.values():
             for body in (op.soap.input.body, op.soap.output.body):
                 body.wrapped = False
                 if len(body.parts) != 1:
                     continue
                 for p in body.parts:
                     if p.element is None:
                         continue
                     query = ElementQuery(p.element)
                     pt = query.execute(self.schema)
                     if pt is None:
                         raise TypeNotFound(query.ref)
                     resolved = pt.resolve()
                     if resolved.builtin():
                         continue
                     body.wrapped = True