Example of Authentication

  • Leonardo Rodríguez

    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 - 2011-02-09

    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()) {


Log in to post a comment.