Available in Ariadne > 2.7.3

ar\connect\soap

The SOAP extension can be used to write SOAP Servers and Clients. It supports subsets of SOAP 1.1, SOAP 1.2 and WSDL 1.1 specifications. Read the PHP manual for complete documentation.

Simple example:

<pinp>
$client = ar('connect/soap')->client(
'http://www.mobilefish.com/services/web_service/countries.php?wsdl'
);

$everything = $client->getIANAInfo();

echo "<h2>First country in the list</h2>";
echo '<p>' . $everything[0][0] . ' is the iana code for '
. $everything[0][1] . "</p>";

$country = $client->CountryInfoByIana('nl');

echo '<h2> Info on the country nl</h2>';
echo '<p>';
echo 'ianacode: ' . $country->ianacode . '<br>';
echo 'countryname: ' . $country->countryname . '<br>';
echo 'coordinates: lat:' . $country->latitude
. ' long: ' . $country->longitude . '<br>';
echo '</p>';
</pinp>

methods

(object) client Returns a new soap client.
(object) header Returns a new soap header object.
(object) param Returns a new soap parameter object.
(object) server Returns a new soap server.
(object) variable Returns a new soap variable object.

client

(object) ar('connect/soap')->client( $wsdl, $options = array() )

(mixed) $wsdl URI of the WSDL file or NULL if working in non-WSDL mode.
(array) $options An array of options. If working in WSDL mode, this parameter is optional. If working in non-WSDL mode, the location and uri options must be set, where location is the URL to request and uri is the target namespace of the SOAP service.

This method returns a new client object that implements all the methods described in the WSDL description.

For more information, see the PHP documentation on SoapClient.

header

ar('connect/soap')->header( $namespace, $name, $data = null, $mustUnderstand = false, $actor = '' )

(string) $namespace The namespace of the SOAP header element.
(string) $name The name of the SoapHeader object.
(mixed) $data A SOAP header's content. It can be a PHP value or a SoapVar object.
(bool) $mustUnderstand Value of the mustUnderstand attribute of the SOAP header element.
(string) $actor Value of the actor attribute of the SOAP header element.

Returns a new soap header object.

For more information, see the PHP documentation on SoapHeader.

param

ar('connect/soap')->param( $data, $name )

(mixed) $data The data to pass or return. This parameter can be passed directly as PHP value, but in this case it will be named as paramN and the SOAP service may not understand it.
(string) $name The parameter name.

Returns a new soap param object.

For more information, see the PHP documentation on SoapParam.

server

ar('connect/soap')->server( $wsdl, $options = array() )

(mixed) $wsdl To use the SoapServer in WSDL mode, pass the URI of a WSDL file. Otherwise, pass NULL and set the uri option to the target namespace for the server.
(array) $options Allow setting a default SOAP version (soap_version), internal character encoding (encoding), and actor URI (actor).

Returns a new soap server object.

For more information, see the PHP documentation on SoapServer.

variable

ar('connect/soap')->variable( $data, $encoding, $type_name = '', $type_namespace = '', $node_name = '', $node_namespace = '' )

(string) $data The data to pass or return.
(string) $encoding The encoding ID, one of the XSD_... constants.
(string) $type_name The type name.
(string) $type_namespace The type namespace.
(string) $node_name The XML node name.
(string) $node_namespace The XML node namespace.

Returns a new soap variable object.

For more information, see the PHP documentation on SoapVar.