0

I created script like this.and I have created token also from admin side.

ini_set('display_errors',1);
require('vendor/zendframework/zend-server/src/Client.php');
require('vendor/zendframework/zend-soap/src/Client.php');
require('vendor/zendframework/zend-soap/src/Client/Common.php');
$token = "e3wcugwhdhqoxccwdli8yxepaih5lm3b";
$opts = ['http' => ['header' => "Authorization: Bearer " . $token]];
$context = stream_context_create($opts);

$wsdlUrl = "http://192.168.11.175/magento2/soap?wsdl&services=customerAccountManagementV1,customerCustomerRepositoryV1";
$serviceArgs = array("customerId" => 1);

$soapClient = new \Zend\Soap\Client($wsdlUrl);
$soapClient->setSoapVersion(SOAP_1_2);
$soapClient->setStreamContext($context);
$soapResponse = $soapClient->customerCustomerRepositoryV1GetById($serviceArgs);
var_dump($soapResponse);

and I’m getting following error when i run the script.

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://192.168.11.175/magento2/soap?wsdl&services=customerAccountManagementV1,customerCustomerRepositoryV1' : failed to load external entity "http://192.168.11.175/magento2/soap?wsdl&services=customerAccountManagementV1,customerCustomerRepositoryV1" in /var/www/html/magento2/vendor/zendframework/zend-soap/src/Client/Common.php:37 Stack trace: #0 /var/www/html/magento2/vendor/zendframework/zend-soap/src/Client/Common.php(37): SoapClient->SoapClient('http://192.168....', Array) #1 /var/www/html/magento2/vendor/zendframework/zend-soap/src/Client.php(1023): Zend\Soap\Client\Common->__construct(Array, 'http://192.168....', Array) #2 /var/www/html/magento2/vendor/zendframework/zend-soap/src/Client.php(1195): Zend\Soap\Client->_initSoapClientObject() #3 /var/www/html/magento2/vendor/zendframework/zend-soap/src/Client.php(1106): Zend\Soap\Client->getSoapClient() #4 /var/www/html/magento2/soapcall.php(16): Zend\Soap\Client->__call('cus in /var/www/html/magento2/vendor/zendframework/zend-soap/src/Client/Common.php on line 37
  • I try run you script and get output like object(stdClass)#3 (1) { ["result"]=> object(stdClass)#4 (12) { ["id"]=> int(1) ["groupId"]=> int(1) ..... } So, maybe problem with access from computer that run script to url 192.168.11.175/magento2 – KAndy Oct 6 '15 at 6:58
  • Thanks for your response.means any specific php extensions missing in my system? – sivakumar Oct 6 '15 at 9:56
  • Don't think so, please open "192.168.11.175/magento2/… in brouser, can you see xml? – KAndy Oct 6 '15 at 11:06
0

@sivakumar :

  1. $token must be the 'Access Token' in System->Integration->YourApiUserDetail. NOT the 'Access Token Secret'.

  2. Check your Magento's base_url. Is it "http://192.168.11.175/magento2/"?

  3. If domain gives the error, then u can set it in your host file.

|improve this answer|||||
  • I have used the access token and my Magento base url is correct too.. But still unable to resolve this error.. – Usman Yousaf Oct 24 '18 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.