A Basic guide to implement a SOAP Client in PHP

2013 年 2 月 16 日3760

A Basic guide to implement a SOAP Client in PHP

Downloading, installing and configuring PHP

PHP is available to download from

http://http://www.zjjv.com///downloads.php

If you are using the installer, the setup will automatically configure apache and other

settings for you.

If you are installing from binaries you will need to perform the following extra steps.

After installation, copy php.ini-dist to your windows directory and rename it to

php.ini

Configuring PHP with Apache

Edit the file httpd.conf in your Apache directory.

Search for the section of the file that has a series of commented out "LoadModule"

statements. Add the following line after all the LoadModule statements: (This line

may vary depending on your PHP version)

LoadModule php5_module "<php root>/php5apache2.dll"

If you are using Apache 2.X, remember to use "c:/php/php4apache2.dll" instead of

"c:/php/php4apache.dll".

For, for Apache 1.3.X users, search for the block of "AddModule" statements. Add

the following line after the last "AddModule" statement: If you're using Apache 2.X,

you do not have to insert the AddModule directive. It's no longer needed in that

version. Apache 2.X has its own internal method of determining the correct order of

loading the modules.

AddModule mod_php4.c

Finally, search for "AddType" in the file, and add the following line after the last

"AddType" statement:

AddType application/x-httpd-php .php

Testing your PHP configuration

Make sure that you have restarted apache after modifying its configuration.

Create a PHP file with the following line:

<?phpinfo()?>

Make sure that your apache httpd.conf document root to point to htdocs. Place the

above file (say phptest.php) in you apache/htdocs folder.

The sample php program can be run on the following url.

http://http://www.zjjv.com///projects/nusoap/

Writing your first SOAP client

One you have configured your environment as described in the previous sections, you

can run your PHP scripts.

The following code illustrates writing a simple PHP script to

Login to PageOne SOAP Services and sending a message.

The wsdl that is used in this example is

https://soap.oventus.com/LiquidWS/MessageService?WSDL

However, we are using a non-wsdl approach to write the PHP

client.

We use the following endpoint to connect to

0 0