So I’m completely new to SOAP and the whole idea behind it, but I am forced to figure it out in order to work with the SuperPages API. For now, I am just trying to wrap my head around it, and how to make calls to the API. The API documentation can be found here: Superpages API. I believe I am formatting the headers and my request correctly, and the credentials I am using (username/password/company ID) have been checked and double-checked and are 100% correct. I have tried to run a couple of the methods described in the API documentation, but continue to receive ambiguous errors (“Fault occurred while processing.”) The current method I am trying to run is:
getReportList
Its documentation can be found in the API documentation at the link above.
My code:
$options = array('trace' => true, 'exceptions' => true);
$sp = new SoapClient('http://services.superpages.com/spexternalservicesv3/services/reportingservice?wsdl', $options);
$header = array();
$header[] = new SoapHeader('webobjects.reporting.pbap.spmd.com', 'username', '******@*********.com');
$header[] = new SoapHeader('webobjects.reporting.pbap.spmd.com', 'password', '*********');
$header[] = new SoapHeader('webobjects.reporting.pbap.spmd.com', 'companyId', '******');
$sp->__setSoapHeaders($header);
try {
var_dump($sp->getReportList("GetReportListRequest"));
} catch (SoapFault $exception) {
echo "<pre>";
var_dump($exception);
echo "</pre>";
}
echo $sp->__getLastRequest();
The result of above code:
object(SoapFault)#5 (8) {
["message:protected"]=>
string(32) "Fault occurred while processing."
["string:private"]=>
string(0) ""
["code:protected"]=>
int(0)
["file:protected"]=>
string(43) "/home/a2op/public_html/billing/sp/index.php"
["line:protected"]=>
int(17)
["trace:private"]=>
array(2) {
[0]=>
array(6) {
["file"]=>
string(43) "/home/a2op/public_html/billing/sp/index.php"
["line"]=>
int(17)
["function"]=>
string(6) "__call"
["class"]=>
string(10) "SoapClient"
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
string(13) "getReportList"
[1]=>
array(1) {
[0]=>
string(20) "GetReportListRequest"
}
}
}
[1]=>
array(6) {
["file"]=>
string(43) "/home/a2op/public_html/billing/sp/index.php"
["line"]=>
int(17)
["function"]=>
string(13) "getReportList"
["class"]=>
string(10) "SoapClient"
["type"]=>
string(2) "->"
["args"]=>
array(1) {
[0]=>
string(20) "GetReportListRequest"
}
}
}
["faultstring"]=>
string(32) "Fault occurred while processing."
["faultcode"]=>
string(11) "soap:Server"
}
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="webobjects.reporting.pbap.spmd.com">
<SOAP-ENV:Header>
<ns1:username>******@*********.com</ns1:username>
<ns1:password>*********</ns1:password>
<ns1:companyId>******</ns1:companyId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:getReportList/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
There are some more details in the post over at stackoverflow (http://stackoverflow.com/questions/5899133/php-soapclient-with-superpages-api-complete-soap-n00b). The superpages API support is not very helpful, and I at a loss as to where else to go for help. I have confirmed with superpages api support that I am using all the right credentials (username, password and companyId). Any ideas / suggestions?