1. Go to this page and download the library: Download zenith/client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zenith / client example snippets
use Zenith\Client\Client;
use Zenith\SOAP\Request;
//build request
$request = new Request;
$request->setService('Acme\HelloWorld', 'sayHi');
$request->setParameter('David');
//build client
$client = new Client('application.wsdl', array('trace' => true));
if ($client->send($request)) {
//get response
$response = $client->getResponse();
//obtain status vars
$statusCode = $response->getStatusCode();
$statusMessage = $response->getStatusMessage();
echo "Server returned a status code $statusCode with message '$statusMessage'\n";
if ($statusCode == 0) {
//obtain result as simple string
$result = $response->getResult();
echo "Result: $result\n";
}
}
else {
//request failed
$faultMessage = $client->getFaultMessage();
echo "Error: $faultMessage\n";
}
use Zenith\Client\Client;
use Zenith\SOAP\Request;
use Zenith\SOAP\Response;
$request = new Request();
$request->setService('Acme\HelloWorld', 'sayGoodbye');
$request->setOption('lang', 'sp');
$client = new Client('application.wsdl', array('trace' => true));
if ($client->send($request)) {
//get response
$response = $client->getResponse();
//obtain status vars
$statusCode = $response->getStatusCode();
$statusMessage = $response->getStatusMessage();
echo "Server returned a status code $statusCode with message '$statusMessage'\n";
if ($statusCode == 0) {
$result = $response->getResult(Response::AS_STRING);
echo "Result: $result\n";
}
}
else {
//request failed
$faultMessage = $client->getFaultMessage();
echo "Error: $faultMessage\n";
}
use Zenith\Client\Client;
use Zenith\SOAP\Request;
use Zenith\SOAP\Response;
$request = new Request();
$request->setService('Acme\HelloWorld', 'parseRequest');
$request->setParameter('<user><id>36233</id><name>David</name></user>');
$client = new Client('application.wsdl', array('trace' => true));
if ($client->send($request)) {
//get response
$response = $client->getResponse();
//obtain status vars
$statusCode = $response->getStatusCode();
$statusMessage = $response->getStatusMessage();
echo "Server returned a status code $statusCode with message '$statusMessage'\n";
if ($statusCode == 0) {
//obtain result as a SimepleXMLElement
$result = $response->getResult(Response::AS_SIMPLEXML);
$id = (int) $result->userid;
$name = (string) $result->username;
echo "ID: $id\n";
echo "Name: $name\n";
}
}
else {
//request failed
$faultMessage = $client->getFaultMessage();
echo "Error: $faultMessage\n";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.