I am trying to connect to a web service and authenticate using the SOAP / wsdl service, but I constantly get an error message:
<b>Fatal error</b>: Uncaught SoapFault exception: [a:InternalServiceFault] Object reference not set to an instance of an object. in /path/install.php:16
Below is my current code:
<?php header("Content-Type: text/plain"); $userinfo = array( 'Username'=>'test', 'Password'=>'test' ); $wsdl_url = 'https://ws-e-distribution.kmd.dk/standard/ServiceAutorisation/ServiceAutorisation.svc?wsdl'; $client = new SoapClient($wsdl_url); print_r($client->__getFunctions()); print_r($client->__getTypes());
I tried all possible ways to reset the username and password parameters that I could imagine, or find someone offering:
- using custom class
- using
stdClass - using
SoapVar - using
SoapParam - using a simple array
- double packed array
- Many combinations of the above.
And I tried to call a function like $client->__soapCall('LogOn', [milliontries]) , as well as $client->LogOn([milliontries])
... nothing works, please help.
Update:
I finally managed to get another error (this suggests that at least I came across something a little less erroneous). Now my code is as follows:
$response = $client->LogOn(array('logon' => array('Username' => 'test','Password' => 'test')));
Which gives me an error when LogOnType not supported (in Danish, which tells me that at least I now have some kind of connection to the server). An array of username and password has no effect, I can replace the empty string and get the same result, which makes the difference in lowercase logon .
If anyone can set up a working example that gives an incorrect username or password error, I will be forever grateful ... but any pointers will be very grateful.
As far as I understand, wsdl provides all the information needed for this, I just have too much [your_pick] to get it ...?