Page tree
Skip to end of metadata
Go to start of metadata

There are many ways to connect using PHP, but the most common way is to use SoapClient, many online resources are available!
You can use to generate a class library from the WSDL or use a simpler approach as shown in the following code example.

PHP Developers

Sample is not created by a PHP Professional, but should give developer a good starting point.

Example using SoapClient

You can define associative array to represent the classes in the WSDL

Store WSDL
PS H:\> (Invoke-WebRequest -Uri "").Content | Se
t-Content C:\temp\wsdl.txt

<!DOCTYPE html>
<h1>DK Superthin client software!</h1>     
<h2>Hello php</h2> 
 echo "Before";         
$client = new SoapClient('C:\temp\wsdl.txt' ,array("soap_version" => SOAP_1_2, "trace" => 1, "cache_wsdl" => WSDL_CACHE_NONE));     
$BS = array(
$member = array(
$Header = new SoapHeader("urn:dkWSValueObjects","BasicSecurity", $BS, false);            


     $comp = $client->GetCompany();     
	 $member = $client->getMember("SOMEID",null); 	 	 
	 //echo $client->__getLastRequest();   
	 echo $member->Name;
	 echo $member->SSNumber; 	 				 			 
	catch (SoapFault $exception) {
	echo $exception;      

echo "After";

Related articles