[Fedora-suds-list] assign user-defined soap headers using Elements?

Tim Butler tim at itldo.org
Fri Oct 24 20:51:29 UTC 2008


Hi,

I'm new to this list.
First, thanks much for an easy to use library that worked (mostly) out of the box.

I have a request that is related to

   Ticket #6 - Add user defined soap headers
   https://fedorahosted.org/suds/ticket/6

I need to add custom header elements for authentication
that have *not* been defined by the wsdl document.

The existing soapheaders mechanism only supports values obtained from client.Factory.

My current workaround is to pass Element objects in soapheaders and then crudely
inject them in the header:

===================================================================
--- binding.py  (revision 322)
+++ binding.py  (working copy)
@@ -289,6 +289,10 @@
          """
          n = 0
          content = []
+        for h in [ e for e in headers if isinstance(e, Element) ]:
+                content.append(h)
+        headers = [ x for x in headers if not isinstance(x, Element)]
+
          if len(headers):
              if method.soap.input.header is None:
                  raise SoapHeadersNotPermitted(method.name)


Could some hook be provided to transform the request doc before sending it
so that I could do something similar. I also currently have the need to fix up
some type attributes... but that's different message :)

Or should I be extending the client.Factory (or whatever schema of types it uses)
to support these elements?

Thanks

-tim





More information about the suds mailing list