[Fedora-suds-list] Need Help with suds.wsse.Security to attach security token to the soap header

Sankumani Sarma ssarma at liquidnet.com
Fri Apr 13 15:00:47 UTC 2012

I am developing a webservice client, which need to first get a security token from the service to invoke the next ServiceAvailabilityCheck() service.
Successfully got the following security token from the webservice.

   Assertion =
         _Version = "2.0"
         _IssueInstant = "2012-04-12T18:13:29.948Z"
         _ID = "saml-1334254409948"
         Issuer = "com.jpmc.morcom.pathway.sts"
         Subject =
               NameID = "LQSCEAPC"
               SubjectConfirmation =
                     _Method = "urn oasis:names:tc SAML:2.0:cm:bearer"
         Conditions =
               _NotOnOrAfter = "2012-04-13T05:13:29.000Z"
               _NotBefore = "2012-04-12T18:13:29.948Z"
         AuthnStatement =
               _AuthnInstant = "2012-04-12T18:13:29.948Z"
               AuthnContext =
                     AuthnContextDecl = "AuthenticationMethod="urn:oasis:names:tc:SAML:2.0:am:password""
         AttributeStatement =
               Attribute =
                     _Name = "scToken"
                     AttributeValue = "AAAAAgABAGgZTFPtW4euBwB63wAdaFYmic81bDHDWpwQ2kmQYeh..cP4tEAXAQE31CS24tltmBzkm406IyKG4e0qLI9hHRthxHHq0pDZNJxR9zqv0jDgm6VOtAYUx6WHt2D6ULUZu6wVhMsT54TqVA__!!57P89XlXgJqBySvo7B2MTCK4lmzPn6Oqn78kAeJiMwS2aRwqUxyEjoazKz.m8Xxlw2WUTbITcESwxN.dvNnfvQGD4kudgMZ5IatTcW9hTir36jEphw41F8zRmRXtUQ7PkJR9yw__"

Now the problem is how to set that security token in  the soap header while invoking the ServiceAvailabilityCheck() service.

I have tried the following:

# getting an instance of the Security module
security =suds.wsse.Security()

# getting an instance of the Token module
token = suds.wsse.Token()

# setting the security token RequestedSecurityTokenType  object received earlier
token.__setattr__('RequestedSecurityTokenType', requestedSecurityTokenType)

# setting the client with the security header

# calling the service now
serviceAvailibility = client_eap.service.ServiceAvailabilityCheck()

I am getting the following error:

  File "build\bdist.win32\egg\suds\client.py", line 539, in __call__
    return client.invoke(args, kwargs)
  File "build\bdist.win32\egg\suds\client.py", line 592, in invoke
    msg = binding.get_message(self.method, args, kwargs)
  File "build\bdist.win32\egg\suds\bindings\binding.py", line 116, in get_message
  File "build\bdist.win32\egg\suds\bindings\binding.py", line 338, in headercontent
  File "build\bdist.win32\egg\suds\wsse.py", line 79, in xml
AttributeError: Token instance has no attribute 'xml'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/suds/attachments/20120413/1e2378eb/attachment.html>

More information about the suds mailing list