logo       

problem with digest auth: msg#00078

php.nusoap.general

Subject: problem with digest auth

Hello,

I´m using nusoap to access a web service with the setCredential function
to use a password protected web service.

With basic auth it works perfectly but if I switch the blackbox (embedded
system) offering the webservice to use digest auth instead of basic I
can´t authenticate. The question I´m asking myself is if it is a problem
of my code, the webservice itself or nusoap...

I was just testing with a short testscript:

-------------------------------------------------------

<?PHP
require_once("nusoap.php");
$username = 'admin';
$password = 'somepasswd';

$soap = new soapclient("http://172.16.183.244/PBX0/user.soap";);
$soap->setCredentials($username, $password, 'digest');
$err = $soap->getError();

// Anlegen von Parameterarray
$params = array(
'user' => '_ADMIN_',
'appl' => 'PhoneBook Script'
);

// create Session
$session = $soap->call("Initialize",$params);
if (!$session)
{
echo ("false");
echo $err;
}
else
{
echo ("true");
echo $err;
}

echo 'Request: <xmp>'.$soap->request.'</xmp>';
echo 'Response: <xmp>'.$soap->response.'</xmp>';
echo 'Debug log: <pre>'.$soap->debug_str.'</pre>';

?>

-----------------------------------------------------------

Here is the reply I get from this script:

<html><head></head><body>falseRequest: <xmp>POST /PBX0/user.soap
HTTP/1.0
User-Agent: NuSOAP/0.6.7 (1.72)
Host: 172.16.183.244
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Authorization: Basic YWRtaW40dm9pcDpzb21lMQ==
Content-Length: 597
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;&lt;SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:si="http://soapinterop.org/xsd"&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:Initialize
xmlns:ns1="http://testuri.org"&gt;&lt;user
xsi:type="xsd:string"&gt;_ADMIN_&lt;/user&gt;&lt;appl
xsi:type="xsd:string"&gt;PhoneBook
Script&lt;/appl&gt;&lt;/ns1:Initialize&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;</xmp>Response:
<xmp>HTTP/1.0 401 Unauthorized
WWW-Authenticate: Digest
realm="Convoi-00-02-03",nonce="c7aa9515ac10b71b",stale=false,qop="auth"
Content-length: 135


&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;401
Unauthorized&lt;/title&gt;&lt;/head&gt;
&lt;BODY&gt;&lt;H1&gt;401 Unauthorized&lt;/h1&gt;
The requested URL was not authorized.
&lt;/body&gt;&lt;/html&gt;</xmp>Debug log: <pre>soapclient: call:
Initialize, Array, , , ,
soapclient: endpointType:
soapclient: in serialize_val: _ADMIN_, user, , , , , encoded
soapclient: in serialize_val: PhoneBook Script, appl, , , , , encoded
soapclient: endpoint: http://172.16.183.244/PBX0/user.soap, soapAction: ,
namespace: http://testuri.org, style: rpc
soapclient: sending msg (len: 597) w/ soapaction ''...
soapclient: transporting via HTTP
soapclient: sending message, length: 597
soapclient: transport debug data...
soap_transport_http: scheme = http
soap_transport_http: host = 172.16.183.244
soap_transport_http: path = /PBX0/user.soap
soap_transport_http: entered send() with data of length: 597
soap_transport_http: calling fsockopen with host 172.16.183.244
soap_transport_http: socket connected
soap_transport_http: wrote data to socket, length = 813
soap_transport_http: found end of headers after length 148
soap_transport_http: read body of length 135
soap_transport_http: received a total of 283 bytes of data from server
soap_transport_http: closed socket
soap_transport_http: HTTP authentication failed
soap_transport_http: end of send()

soapclient: Error: HTTP Error: HTTP authentication failed

</pre></body></html>

---

Switching both sides back to basic auth works again... Acsessing the
system using a web browser works with digest auth.

Any suggestions for my problem? I´m espicially worried about the line
"Authorization: Basic YWRtaW40dm9pcDpzb21lMQ==" in the header...

Thank you

Kind regards
Michael


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg297


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise