WIth the SOAP protocol you can exchange data with other machines. For this the configuration, the operating or different hardware does not matter, as long as you respect the interface definition. For a programmer a SOAP interface may be important, because there are many services out there that are able to share their data with this protocol. I had some projects and had to learn how SOAP works for PHP. For my projects, I communicate from a Linux server with PHP as programming language with a Windows server where the interface runs with .NET.
Native PHP Client
PHP supports a native SOAP Client since version 5. This Client accepts SOAP 1.1 and SOAP 1.2. SOAP is a network protocol. Sometimes it gets some new functions. For this there are new version numbers. At this time, these two are the current version numbers. SOAP interfaces normally supports both. To create a new SOAP client, do the following:
$client = new SOAPClient($wsdl, $parameter);
You can see that we need 2 params for your SOAP client. The first one is the so called WSDL, the second one an array of other params.
A WSDL is used to communicate with the interface. A WSDL defines how to communicate and also defines whick data can be sent and also defines the type of data. That sounds complicated, but actually a WSDL file is only a XML file that defines all elements that are accepted during communication. The communication works like this:
The sender (we) sends a XML file to the web service. The content of this XML defines the data that we want from the interface. We are only allowed to request elements that are defined in WSDL. Otherwise we will only receive an error message.
The recipient (the web service) accepts this XML request, collects the data and then returns a response XML. This XML has also only elements that are defined in our WSDL.
With this strict communication it is not possible to send or receive data that is not defined. This may result in some errors in our programming because we may often send false data. You can find the WSDL file for .NET interfaces normally at this location:
You can open this WSDL in your browser. It is only a large XML file.
There are many possible params. A complete list can be found here. It is a typical case that SOAP interfaces only offers data for registered users. For this you can user params for login data and password. You can also define the SOAP version. A typical list of params could look as follows:
$soap_param = Array(
'login' => "LOGIN",
'password' => "PASSWORD",
'soap_version' => SOAP_1_2,
'exceptions' => True,
'trace' => 1
You can see that we define login data and a password. Also we want to communicate with SOAP version 1.2. The other two params are for debug purposes.
In the next article I show you different ways to communicate with this interface.