Here are my expirience in working with NuSoap (SOAP) in PHP.

Creating simple SOAP function is simple,  so there is no need to explain.

Problems are coming when you need a complex types, like array, and UTF-8 encoding.

Here is an example of adding complex type to your SOAP server:

'Chapter', //name
'complexType', //typeClass (complexType|simpleType|attribut)
'struct', //phpType: currently supported are array and struct (php assoc array)
'all', //compositor (all|sequence|choice)
'', //restrictionBase namespace:name (
array( //elements = array ( name = array(name=>”,type=>”) )
'title' => array('name'=>'title','type'=>'xsd:string'),
'page' => array('name'=>'page','type'=>'xsd:int')
) );
'tns:Chapter' );

'author' => array('name'=>'author','type'=>'xsd:string'),
'title' => array('name'=>'title','type'=>'xsd:string'),
'numpages' => array('name'=>'numpages','type'=>'xsd:int'),
'toc' => array('name'=>'toc','type'=>'tns:ChapterArray')
) );

'getBook', // method name
array('title'=>'xsd:string'), // input parameters
('return'=>'tns:Book'), // output parameters
$NAMESPACE); // namespace

getBook($title) {
// Create TOC
$toc = array();
$toc[] = array('title' => 'Chapter One', 'page' => 1);
$toc[] = array('title' => 'Chapter Two', 'page' => 30);

// Create book
$book = array(
'author' => "Jack London",
'title' => $title,
'numpages' => 42,
'toc' => $toc);

return $book;

Taken from here.

Comments are taken from here.

Client example:


$namep = "Title";
$param = array('String_1' => $namep);

$endpoint = "http://localhost/server.php";

$mynamespace = "http://
$client = new soapclient($endpoint);

$client->decodeUTF8 = true;
$response = $client->call('
getBook', $param, $mynamespace);
print_r ($response['author']);
echo '<p/>'.$client->response;

Now, if you want to use utf - 8, you will have to in nusoap.php on line 152, instead of:

var $soap_defencoding = 'ISO-8859-1';

Add or uncomment:

var $soap_defencoding = 'UTF-8';

Also, on server side I added:

$server->decode_utf8  =  true; 

If you are using MySQL and data are encoded in Windows-1252 (like mine) then you will need to put:

mysql_query('set names utf8');

In  your server side.

I hope that is all.

If you are receiving error "The specified module could not be found." then try to instead of "C:Program FilesPHPphp5isapi.dll" write C:Progra~1PHPphp5isapi.dll (without quotes) in Web Sites node, and in Default Web Site node, or any other. Right -> Properties -> Home Directory -> Cofiguration, find .php and click edit.


Also,extension are now in C:Program FilesPHPext, so if you are using MS SQL PHP extension for MS SQL then you will need manually to copy files php_sqlsrv_ts.dll and php_sqlsrv.dll to that folder.

 Taken from my brain :P

Whenever is possible use parameterized queries in MS driver for PHP for MS SQL, to reduce risko of SQL injection attack.Taken from here.


Using of parametrized queries is simple, you can use example from here, for varchar types everything is same (you don't need quotes, as I thought) .



There is no such thing as TStringList 

So, note to my self, for saving files in PHP (good for geting and analyzing queries) :


$fp = fopen('c:data.txt', 'w');
fwrite($fp, $MySQL);

Taken from here.