I try to connect to SOAP with php and here is my code:
$wsdl = 'http://websiteservicesvplus.mpfrance.fr/WebServicesVPlus.asmx?wsdl';
$soap = new SoapClient($wsdl, $options);
$data = $soap->CheckConnection(
array(
'ApiKey'=>'63156585fd3e7a69d6e66c67a92b095b0b8b1478bedffc9137ba9cf8c1dc5088',
'ApiTokenUserId'=>'5',
'ApiTokenTypeId'=>'8'
)
);
var_dump($data);
die;
After I run it on the browser, I got this message error only :
"Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\wamp\www\test\webservices\server1.php:23 Stack trace: #0 C:\wamp\www\test\webservices\server1.php(23): SoapClient->__call('CheckConnection', Array) #1 C:\wamp\www\test\webservices\server1.php(23): SoapClient->CheckConnection(Array) #2 {main} thrown in C:\wamp\www\test\webservices\server1.php on line 23"
Anyone can help me?
First, I would use a WSDL to php generator to ease the SOAP Web Service consumption (like using the PackageGenerator project),
Second, you're missing the SOAPHeader declared in:
<wsdl:operation name="CheckConnection"> <soap12:operation soapAction="http://qpc.ebp.be/CheckConnection" style="document"/> <wsdl:input> <soap12:body use="literal"/> <soap12:header message="tns:CheckConnectionAuthHeader" part="AuthHeader" use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation>
. Once again, using the project references before, it will be defined in the tutorial.php file in order to send it easily.