php - SOAP and NTLM Authentication between Debian an IIS Server -
i have problem soap authentication in php. have check everywhere answer without success.
i hope 'll able me here !
so, here deal.
my php application server debian 6 apache2 , web service based on iis server.
both servers inside our company network.
for connection , authentication use class find on web :
http://tcsoftware.net/blog/2011/08/php-soapclient-authentication/
here code using class :
<?php define('curlopt_certinfo',1); ini_set("max_execution_time",120); ini_set('default_socket_timeout', 120); ini_set("soap.wsdl_cache_enabled", "0"); ini_set('soap.wsdl_cache_ttl',0); include('./soapclientauth.php'); //wsdl $soapurl = "http://myapplicationadress/ws/web100t/patient_identite_chargerparid.wsdl"; $soapparameters = array( 'login' => 'anadlogin', 'password' => 'theadpassword', 'exceptions' => 1, 'trace' => 1, 'user_agent' => '', 'keep_alive' => 1 ) ; $soapclient = new soapclientauth($soapurl, $soapparameters); try{ $soapresult = $soapclient->patientidentitechargerparid(array('patid' =>'152')); } catch(soapfault $fault) { var_dump($fault); }
nb : "define('curlopt_certinfo',1);" added because constant not defined in our php version. if dont define it, have error :
[03-sep-2013 15:10:50 utc] php notice: use of undefined constant curlopt_certinfo - assumed 'curlopt_certinfo' in /var/www/vm-test/soapclientauth.php on line 97 [03-sep-2013 15:10:50 utc] php warning: curl_setopt() expects parameter 2 long, string given in /var/www/vm-test/soapclientauth.php on line 97
the result of connection client debian server 401 error, cf below :
* connect() web100t-qualif port 80 (#0) * trying 172.16.101.93... * connected * connected web100t-qualif (172.16.101.93) port 80 (#0) > post /mwsiissrv.dll/mws/ws/_mws_soap http/1.1 host: web100t-qualif accept: */* user-agent: php-soap content-type: text/xml; charset=utf-8 soapaction: "/patient/identite/chargerparid" content-length: 309 expect: 100-continue connection: keep-alive < http/1.1 401 unauthorized < content-type: text/html < server: microsoft-iis/7.5 < www-authenticate: ntlm
in second time, if comment line number 97 in soapclientauth.php constant curlopt_certinfo used :
curl_setopt($ch, curlopt_certinfo, true);
then reponse change below :
< http/1.1 401 unauthorized < content-type: text/html < server: microsoft-iis/7.5 < www-authenticate: ntlm * gss_init_sec_context() failed: : credentials cache file '/tmp/krb5cc_33' not found< www-authenticate: negotiate < date: tue, 03 sep 2013 12:37:00 gmt < content-length: 1384 < * connection #0 host web100t-qualif left intact * closing connection #0 * connect() web100t-qualif port 80 (#0) * trying 172.16.101.93... * connected * connected web100t-qualif (172.16.101.93) port 80 (#0) > post /mwsiissrv.dll/mws/ws/_mws_soap http/1.1
i dont know why kerberos mentionned here ... may clue.
last not least,
code works on local machine, windows one. moreover, curlopt_certinfo seams configured because dont need redefined on windows environnement.
well, know moment. can't figure problem come from. it's surely due problem of authentication between debian , iis ... dont understand more.
do not hesitate if need other informations. thank help.
for information found workaround resolve problem.
the problem due fact iis server needed ad login / password let our php application connect web service.
what did using other url reach web service, url needing "anonymous" account. means account defined application , not ad.
consequently don't need use ntlm authentication, problem coming from.
Comments
Post a Comment