Docstoc

PHP5 SOAP Example

Document Sample
PHP5 SOAP Example Powered By Docstoc
					PHP5 SOAP Example




                    Revised May 21, 2007




                    Need a little advice?
                    Visit the SoftLayer
                    Development Network (SLDN)

                    http://sldn.softlayer.com
                    sldn@softlayer.com
PHP5 SOAP Example



Table of Contents

1   Preface          ............................................................................................................................................................3

2   Prerequisites ........................................................................................................................................................3

3   Configuration ........................................................................................................................................................3

4   Initial Tests ...........................................................................................................................................................4

            4.1 Data Test ............................................................................................................................................4

            4.2 File Test ..............................................................................................................................................4

5   Problems? ............................................................................................................................................................5




                                                                                                                                                                                     Need a little advice?
                                                                                                                                                                                     Visit the SoftLayer
                                                                                                                                                                                     Development Network (SLDN)

                                                                                                                                                                                     http://sldn.softlayer.com
                                                                                                                                                                                     sldn@softlayer.com




                                                                                                                                                                                                                  2
PHP5 SOAP Example



1          Preface

This script is intended as an example for using SOAP and PHP 5.+ to connect to the SoftLayer API.
It is not intended for production use, but as an example to jump start your development.



2          Prerequisites

To use this example you will need a web server with PHP 5.+ with SOAP support enabled.
http://www.php.net/manual/en/ref.soap.php


You will also need a connection to the SoftLayer private network.



3          Configuration

Located in this folder is a file named config.ini.php, you will need to update this file with:

n	   Portal Username

n	   API Security Key, generated from within the customer portal

n	   An identifier to a server on your account, which could be any of the following:
	


	    n	     A server ID

     n	    Primary Public IP Address

     n	    Primary Private IP Address




                                                                                                    Need a little advice?
                                                                                                    Visit the SoftLayer
                                                                                                    Development Network (SLDN)

                                                                                                    http://sldn.softlayer.com
                                                                                                    sldn@softlayer.com




                                                                                                                                 3
PHP5 SOAP Example



4             Initial Tests

At this point everything should be setup and ready to go. There are two test file included with this example:



1.   Data Test -- data-test.php / data-test.html


The data test performs a few quick data tests to verify you can communicate with the API Server.
It should retrieve:

n	   List of all servers on the account, this user has permission for (getServerList)

n	   List installed software for the server defined in the configuration file (getServerSoftwareDetails)

n					
     	   List server specifications for the server defined in the configuration file (getServerHardwareDetails)

n						  List server network information for the server defined in the configuration file (getServerNetworkDetails)

n	   List servers with bandwidth allowances for all servers on the account, this user has permission for
     	


     (getBandwidthList)



2.   File Test -- file-test.php / file-test.php


The file test provides an example for retrieving a bandwidth image for the server specified in the configuration file
for the last 24 hours on the public network port. This url could be placed in an <img> tag for displaying images on
a web page.




                                                                                                                        Need a little advice?
                                                                                                                        Visit the SoftLayer
                                                                                                                        Development Network (SLDN)

                                                                                                                        http://sldn.softlayer.com
                                                                                                                        sldn@softlayer.com




                                                                                                                                                     4
PHP5 SOAP Example



4          Problems?

1.   Is there maintenance going on?


Check the SoftLayer forums https://forums.softlayer.com for maintenance or outage notifications pertaining to the
API servers.



2.   Are you connected to the SoftLayer private network?


Test that you can reach the api.service.softlayer.com url
# ping api.service.softlayer.com


If you can not reach the url, you will need to verify that your private network connection is established
to SoftLayer.



3.   Is your web server configured properly?


We have provided a info.php file with this example. If you go to this page in your web browser, you should see
an information page regarding your PHP configuration.


If you see PHP source code or no output at all your web server is not configured properly.



4.   Still need help?


Below is a list of available sites for a support for this example:


http://sldn.softlayer.com
https://forums.softlayer.com (API Section)




                                                                                                                    Need a little advice?
                                                                                                                    Visit the SoftLayer
                                                                                                                    Development Network (SLDN)

                                                                                                                    http://sldn.softlayer.com
                                                                                                                    sldn@softlayer.com




                                                                                                                                                 5

				
DOCUMENT INFO
Shared By:
Tags: PHP5, SOAP, Example
Stats:
views:139
posted:8/9/2010
language:English
pages:5
Description: Initial Tests At this point everything should be setup and ready to go. There are two test file included with this example: 1. Data Test -- data-test.php / data-test.html The data test performs a few quick data tests to verify you can communicate with the API Server. It should retrieve: n List of all servers on the account, this user has permission for (getServerList) n List installed software for the server defined in the configuration file (getServerSoftwareDetails) n List server specifications for the server defined in the configuration file (getServerHardwareDetails) n List server network information for the server defined in the configuration file (getServerNetworkDetails) n List servers with bandwidth allowances for all servers on the account, this user has permission for (getBandwidthList) 2. File Test -- file-test.php / file-test.php