Super PHP .NET - PHP SOAP Client

easy consumption of .NET web services and datatable parsing in PHP


  • PHP 5.2.x or higher
  • SOAP must be enabled in php.ini
  • .NET 2.0 or higher (if using .NET web services)


  • For development purposes, you may want to disable WSDL caching in php.ini - for production, turn it on


Unpack the package that you downloaded and upload the folder SuperDotNet to your PHP enabled web server (has been tested on both IIS and Apache). If you look inside the folder you should see SuperDotNet.php and a folder called plugins. The first is required for Super PHP .NET (SPN) to run properly. You will more than likely need a plugin at some point (for data transformations) so make sure the plugin folder gets uploaded. Note the directory path for inclusion later.


Include the SuperDotNet file in your script and declare a new instance of the class.


	$service = new SuperDotNet;

SPN works in this way. After you instantiate your class you add WSDL URLs to your WSDL library (an array of WSDLs that you can reference any time). After you have a WSDL reference you declare any plugins that you may want to use. Plugins are fired for each datarow in a datatable and are used to transform data into a more useable format. SPN ships with three plugins -> integer, timespan, and datetime. See the plugins section for details on their use and how to write your own plugins.

Add a URI and declare your plugins, so your script should look like this now.


	$service = new SuperDotNet;

	$service->addURI("GetUserByID", "");
	$service->setPlugins("integer"); //converts numeric only strings to PHP integers

Now we have a WSDL which can be referenced by "TestService". Its time to make a SOAP call to your web service. Make sure that you have a working .NET web service that returns a datatable. You can use SPN as a SOAP client for any web service but for our example we will be consuming a datatable (since that is the goal of this project).

Our web service has one function "GetUserByID" which takes one parameter - ID. (Remember that both the function and the parameters are CASE-SENSITIVE. If you are having trouble making SOAP calls or passing parameters then check your spelling and your cases!)

Our code now looks like this.


	$service = new SuperDotNet;

	$service->addURI("USER", "");
	$service->setPlugins("integer"); //converts numeric only strings to PHP integers

	$service->soapCall("USER", "GetUserByID", ParameterBuilder::build("ID=63"));

We make a SOAP call to our reference, USER with the function GetUserByID and then use the parameter builder to pass parameters to the web service. If you don't want to use the parameter build, just pass an array like you normally would with SOAP. If you want more detailed information on this, check out

After your call is completed, the results of the SOAP call should be available for use as an array of objects. By default the objects are created as PHP's standard stdClass but you can declare your own class to use by declaring this before you make you SOAP call.


Use to access the results of your call.


Last edited Dec 2, 2009 at 6:34 PM by Blackshawk, version 5


No comments yet.