I'm completely new to using SOAP, and am looking to create some client software connecting to an existing service that provides no resources/demo's for PHP. I'd like to determine if I'm doing something wrong with my code, or if it's perhaps a systems issue (I've created an Apache2.4/PHP7.2.7 on Windows Server 2008 R2 environment).
I've already spent hours going testing things and going through the numerous other SOAP/PHP topics on here, and the point of distinction I've where I'm making my own thread is that the authentication is required in the SoapClient call but rather the $client->__soapCall(function, params)call.
First this is what I have in PHP.
$customerArray = array( $cust1 , $cust2, $cust3 );
$credentials = array(
'login' => $login,
'password' => $password,
);
try{
$client = new SoapClient($soaplink);//, $credentials);
} catch (Exception $e) {
echo "<h2>Exception Error in SoapClient</h2>";
echo $e->getMessage();
}
var_dump($client->__getFunctions());
try{
$response = $client->__soapCall("getCustomers", array($customerArray, $credentials));
}catch (Exception $e) {
echo "<h2>Exception Error in soapCall</h2>";
echo $e->getMessage();
}
var_dump($response());
The first try block completes, with or without the credentials array. The second try block when trying to call the function returns the exception "looks like we got no XML document".
The SOAP service provided demo XML files, the one for this function looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getCustomers
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://ws.praxedo.com/2008_07_01/customermodel/service"
>
<in0
soapenc:arrayType="soapenc:string[3]"
xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>
<in0 xsi:type="soapenc:string">CUSTOMER001</in0>
<in0 xsi:type="soapenc:string">CUSTOMER002</in0>
<in0 xsi:type="soapenc:string">CUSTOMER003</in0>
</in0>
<in1
xsi:type="soapenc:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>
login|password
</in1>
</ns1:getCustomers>
</soapenv:Body>
</soapenv:Envelope>
WSDL files were also provided, it could be I need to load from that but following a demo to do so provided no results. I could include some of the WSDL here but I believe the XML provides all the relevant details?
So can anyone see if there's something I'm doing wrong here in my PHP, or should what I'm doing work and I need to look into the client Apache/SOAP server side?