This problem is killing me all day.
Do I have a https: // * .asmx client web service? WSDL, with basic HTTP authentication ..
If I use SoapUI to connect to a web service, everything works fine, without any errors ..
The problem is when I switch to PHP ...
I managed to connect to it and I can get a list of functions from the server using the soapclient extension for php (I am using PHP 5.3.0).
When I try to call a function using the soapclient extension for PHP, I get the following error:
Fatal error: throw exception SoapFault: [HTTP] Error Retrieving http headers in C: \ www \ xpto_Atestes \ soapclient.php: 26 Stack trace: # 0 [internal function]:> SoapClient โ __ doRequest ('*** ... ',' http: // **** ... ', 1, 0) # 1> C: \ www \ xpto_Atestes \ soapclient.php (26): SoapClient โ __ soapCall (' login ', Array) # 2 {main}> thrown at C: \ www \ xpto_Atestes \ soapclient.php on line 26
A more obvious error (when I do print_r of the call result):
[faultstring] => Error retrieving HTTP headers
[faultcode] => HTTP
When sending the following headers:
POST / * .asmx HTTP / 1.1 Host: * .pt Connection: active user agent:> PHP-SOAP / 5.3.0 Content-Type: text / xml; charset = utf-8 SOAPAction: "http: // ** / Login"> Content-Length: 264 Authorization: Basic AUTHSECETETTE
I call it this way:
$ soapParams = array ('login' => 'HTTP_LOGIN',
'password' => 'HTTP_PASS',
'authentication' => SOAP_AUTHENTICATION_BASIC,
'trace' => 1,
'exceptions' => 0
);
$ client = new SoapClient ("https: // **** .asmx? WSDL", $ soapParams); echo "Connected
"; $ params = array ('account' => '', 'msisdn' => 'NUMBER', 'password' => 'PASSWORD'); $ result = $ client โ __ soapCall (" login ", $ params) ;
After some time googling and trying to figure out what the problem is, I switched to nusoap .., which, unfortunately, also gave an error:
Error
HTTP error: timeout reading header headers
Request
POST / ** .asmx HTTP / 1.0 Host: * .pt User-agent: NuSOAP / 0.9.5 (1.123) Content-Type: text / xml; encoding = ISO-8859-1 SOAPAction: "http: // **** / Login" Authorization: Basic AUTHSECRETPASS Content-Length: 481
NUMBERPASSWORD
answer
I call it this way:
$ client = new nusoap_client ("https: // ** .asmx? WSDL", true); $ Client-> SetCredentials ('HTTPUSER', 'HTTPPASS', 'primary');
$ params = array ('account' => '', 'MSISDN' => 'NUMBER', 'Password' => 'PASSWORD');
$ result = $ client-> call ('Login', $ params);
Using nusoap, I also tried to enable curl extension to make calls:
$ client-> setUseCurl (true);
But there is no such luck, he continued to give an error:
HTTP error: cURL ERROR: 56: Failure when receiving data from the partner url: http: // ********* .asmx
content_type:
http_code: 0
header_size: 0
request_size: 750
filetime: -1
ssl_verify_result: 0
redirect_count: 0
total_time: 21.015
namelookup_time: 0
connect_time: 0
pretransfer_time: 0
size_upload: 462
size_download: 0
speed_download: 0
speed_upload: 21
download_content_length: -1
upload_content_length: -1
starttransfer_time: 0
redirect_time: 0
I am 100% sure that there is nothing wrong with webservice, if I can call it from SoapUI without any problems, I donโt understand why I canโt call it from PHP.
I rally I donโt know what else I can do. I think I tried everything ...
Edit: I just tried another Soap class for PHP, this time from Zend ..
Result:
Fatal error: SoapFault exception: [WSDL] SOAP-ERROR: WSDL analysis: Could not load from 'https: // ** .asmx? WSDL ': Failed to load external object "https: // * .asmx? WSDL" in C: \ www \ xpto_Atestes \ Zend \ Soap \ Client \ Common.php: 51 Stack trace:
# 0 C: \ www \ xpto_Atestes \ Zend \ Soap \ Client \ Common.php (51): SoapClient-> SoapClient ('https: // ** ...', Array)
# 1 C: \ www ** ** _Atestes \ Zend \ Soap \ Client.php (1032): Zend_Soap_Client_Common โ __ construct (Array, 'https: // ** ...', Array)
# 2 C: \ www ** ** _Atestes \ Zend \ Soap \ Client.php (1188): Zend_Soap_Client โ _ initSoapClientObject ()
# 3 C: \ www ** * _Atestes \ Zend \ Soap \ Client.php (1112): Zend_Soap_Client-> getSoapClient () # 4 [internal function]: Zend_Soap_Client โ __ call ('Login', Array)
# 5 C: \ www ** ** _Atestes \ zend.php (28): Zend_Soap_Client-> Input (array)
# 6 {main} thrown at