cURL / Mailing Lists / curl-users / Single Mail

curl-users

<wsse:Password> Base64 with cURL

From: thomas Armstrong <tarmstrong_at_gmail.com>
Date: Fri, 22 Feb 2008 13:01:58 +0100

Hi.

I want to make a cURL petition to a SOAP webservice, and I'm required
to include a UserToken header.

I suppose it might be in this way:
----------
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
SOAP-ENV:mustUnderstand="1">
      <wsse:UsernameToken>
            <wsse:Username>testing</wsse:Username>
        <wsse:Password>foo</wsse:Password>
                <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2005-05-16T07:00:03Z</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <GetUserData xmlns="http://ws.domain.com/">
      <firstName>555</firstNumber>
      <lastName>Smith</lastName>
    </GetUserData>
  </soap:Body>
</soap:Envelope>
--------------

But I received a "HTTP/1.1 400 Bad Request" message error from
WebService Server.

I'm been investigating, and perhaps I'm required to Base64 this
password, as mentioned in:
http://www.oasis-open.org/committees/wss/documents/WSS-Username-02-0223-merged.pdf

Password_Digest = Base64 ( SHA-1 ( nonce + created + password ) )

But I don't know how to convert Password into this Base64. I work with
Linux from the shell, but I can also do it with PHP.

Thank you very much.
Received on 2008-02-22