[Fedora-suds-list] WSSE

Glenn Franxman gfranxman at gmail.com
Tue Jan 27 23:55:05 UTC 2009


I'm only just getting started with SOAP, so forgive the n00b questions.

I'm trying to create calls that look something along the lines of:

<?xml version="1.0" encoding="UTF-8"?>
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://amp.yahooapis.com/V1">
  <soapenv:Header>
   <wsse:Security>
    <wsse:UsernameToken>
     <wsse:Username>user</wsse:Username>
     <wsse:Password>password</wsse:Password>
    </wsse:UsernameToken>
   </wsse:Security>
   <license>3cf33e7-5ad1-3a9-093-3681f55eb0</license>
   <accountID>9966673</accountID>
  </soapenv:Header>
  <soapenv:Body>
   ...
  </soapenv:Body>
 </soapenv:Envelope>

To that end, I'm trying to add clauses for wsse:Security, license and accountID.
That section of my code looks like:

    ...
    #construct WS-Security header for username/password
    WSSE_NS = "http://schemas.xmlsoap.org/ws/2002/07/secext"
    client.add_prefix( 'wsse', WSSE_NS )

    #build account headers
    license  = client.factory.create('license')
    license.set(  License_Key )
    accountid  = client.factory.create('accountID')
    accountid.set( Master_Account_Id )

    client.set_options(soapheaders=(  license, accountid))
    ...

and it is resulting in:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://amp.yahooapis.com/V1"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="http://amp.yahooapis.com/V1"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
      <tns:license>...</tns:license>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
     ...
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I'm still trying to feel my way through this, but I'm already wondering:

    What happened to the wsse namespace that I added?
    What happened to the license header that I added?

    Has anyone successfully used WSSE with suds?




More information about the fedora-suds-list mailing list