Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


Example of Authentication

  • Hi!
    I need to authenticate my web service with NuSOAP, Can you give me some (link to) example to learn that ? My first attempt will be with basic authentication. In google, i could not find a good example.
    Thank you

  • Scott Nichol
    Scott Nichol

    If you are creating the web service, you can use the HTTP authentication in your web server.  The other alternative is to roll your own, such as having username/password parameters to every SOAP method.

    If you are consuming the service, you call setCredentials on your $client:

    * if authenticating, set user credentials here
    * @param    string $username
    * @param    string $password
    * @param string $authtype (basic|digest|certificate|ntlm|any)
    * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
    * @access   public
    function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {