Reputation: 2970
So i started building something like a wrapper class for the SOAP API of Magento 1.7.0.2 CE following the instructions here
<?php
class magSoap
{
private $client;
private $session;
function __construct()
{
$this->client = new SoapClient('http://localhost:7655/magento1702CE/index.php/api/soap/?wsdl');
var_dump($this->client);
file_put_contents("xml.txt",file_get_contents("http://localhost:7655/magento1702CE/index.php/api/soap/?wsdl"));
$this->session = $this->client->login('test', '1234567890');
echo "hello";
}
function test()
{
var_dump($this->client->call($this->session, 'sales_order.list'));
}
}
?>
when i run the following code
$tester = new magSoap();
$tester->test();
i get the following
googling the error the answer i keep seeing is that i got invalid XML so i navigated to the URL i used in SoapClient
and i didn't see anything wrong. then i created that file_put_contents
line so i could output the xml to a text file and use this WSDL Analyzer but doesn't show me any errors
the SOAP Login is test, the key is 1234567890, the SOAP Role has full access, i have disabled "Auto-redirect to Base URL", php_soap is enabled in WAMP Server and PHP version is 5.6.25.
Why is it this code still wont work?
Upvotes: 0
Views: 1036
Reputation: 11
I spent many hours in a integration with Magento..
In my case I found out that the SOAP Response of my call had some special html characters and then the SOAP considered is as not an XML response.
What helped me was putting a try-catch in the soap call and use the soap methods __getRequest() and __getResponse() to see what was going on.
Hope it helps someway :)
Upvotes: 1