I need to build a client for soap api that has a separate base url for get and post http methods.
There are two separate WSDLs: one lists actions to read data and another one to insert data, for example: https://www.example.com/webservices3/ExampleWS.asmx and https://www.example.com/webservices3/ExampleWSPost.asmx.
How do I implement the client with multiple base urls?
Normally, with a single base url, I'd do something like this:
use SoapClient;
class ExampleApiClient
{
protected $client;
public function __construct()
{
$this->client = new SoapClient('example.com/path?wsdl');
}
public function getUser($args)
{
return $this->client->soapCall('exampleAction', $args);
}
public function addUser($args)
{
return $this->client->soapCall('exampleAction', $args);
}
}
// which then will be called somewhere in the code like this:
$api = new ExampleApiClient();
$api->getUser(12);
Clientclass do?