0

I have a problem connecting to a web service, below is my code:

$path = __DIR__;
$wsdl = "https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL";
$urlC = $path."/wise-europeanbroker.vbnl6w.p12";

$soap_args = array(
     "login" => "europeanbrokers",
     "password" => "xxxxxx",
     "local_cert" => $urlC,
     'user_agent' => 'PHPSoapClient',
     "user_agent" => "PHP/SOAP",
     "accept" => "application/xml",
     "exceptions"=>true,
     "trace" => true,
     "http" => array('protocol_version' => '1.0'));
try {
     $context = stream_context_create($soap_args);
     $client = new SoapClient($wsdl,array('stream_context' => $context));
     echo "Connection ok\n";

} catch (SoapFault $e) {
     var_dump($e.message);

}

I think the above code is OK but I always get the below error:

string(428) "SoapFault exception:
[WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from 'https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL' :
failed to load external entity "https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL"
in D:\siti\soap.test.local\SClient.php:40
Stack trace:
#0 D:\siti\soap.test.local\SClient.php(40):
SoapClient->SoapClient('https://wisetes...', Array)
#1 {main}message"

What could be the problem?

  • Looks like a network problem to me. Can you try visiting [the URL of the WSDL](https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL) on your machine and see if it loads? – FelisCatus Nov 25 '15 at 09:08
  • Does your company enforce a proxy ? Check your browser or operating system settings. And you might want to change your password _now_ ;-) – Marged Nov 25 '15 at 09:11
  • It's the certificate: it's self-signed. `SoapClient` will reject it by default unless you turn off certificate validation. Refer to [this answer](http://stackoverflow.com/questions/8443618/disable-certificate-verification-in-php-soapclient) to find out how to disable certificate validation for `SoapClient`. – Linus Kleen Nov 25 '15 at 09:12
  • Thank you guys, i try to disabled certificate verification. Unfortunately it's not enough, i have new error: string(311) "SoapFault exception: [Client] SoapClient::SoapClient() [soapclient.soapclient]: Invalid parameters in ...local\SClient.php:31 Stack trace: #0 ...local\SClient.php(31): SoapClient->SoapClient('https://wisetes...', Resource id #2) #1 {main}message" Sorry but this is first time i work with Web Service and the owners of the web service don't help me. – Gabriele Placidi Nov 25 '15 at 10:13

1 Answers1

0

You can try browsing https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL and see that that site uses an invalid certificate. Try adding verify_peer=FALSE into SSL context options.

user17417
  • 35
  • 5