1

I am tried "configurableProductLinkManagementV1" to add simple product to configurable product.

$result = $soapClient->configurableProductLinkManagementV1addChild(
arr‌​ay('sku' => 'sampleconfigurable','childsku'=>'samplesimpleproduct'));

But, I am getting

PHP Fatal error: Uncaught SoapFault exception: [Sender] SOAP-ERROR: Encoding: object has no 'childSku' property in vendor/zendframework/zend-soap/src/Client.php:1116

=========================================================

<?php
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 = 'udctff3sq02h1d90e44xr3nk282khabt';
$wsdlUrl = 'http://127.0.0.1/magento2/soap/default?wsdl&services=configurableProductLinkManagementV1';
$opts = ['http'=> ['header' => "Authorization: Bearer " .$token]];
$context = stream_context_create($opts);
$soapClient  = new \Zend\Soap\Client($wsdlUrl);
$soapClient->setSoapVersion(SOAP_1_2);
$soapClient->setStreamContext($context);
$result = $soapClient->configurableProductLinkManagementV1addChild(array('sku' => 'sampleconfigurable','childsku'=>'samplesimpleproduct'));
?>
  • Show your Json content. – Khoa TruongDinh Dec 22 '17 at 4:14
  • i am adding like this $result = $soapClient->configurableProductLinkManagementV1addChild(array('sku' => 'sampleconfigurable','childsku'=>'samplesimpleproduct')); – shivashankar m Dec 22 '17 at 4:49
0

Try this:

<?php
error_reporting(E_ALL);
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');

$wsdlurl = 'http://127.0.0.1/magento2/index.php/soap/default?wsdl&services=configurableProductLinkManagementV1';
$token = '<your_tokne>';
$opts = ['http' => ['header' => "Authorization: Bearer ".$token]];
$context = stream_context_create($opts);
//$arguments =
$serviceArgs = array(
    'sku' => 'configurable01',
    'childSku' => 'blue01',

);


$soapClient = new \Zend\Soap\Client($wsdlurl);
$soapClient->setSoapVersion(SOAP_1_2);
$soapClient->setStreamContext($context);
$result = $soapClient->configurableProductLinkManagementV1addChild($serviceArgs);
echo "<pre>"; 
print_r($result); 
?>
  • i tried but it's not working – shivashankar m Dec 22 '17 at 6:00
  • @shivashankarm still got same error? – Abdul Dec 22 '17 at 6:23
  • yes i am getting same error – shivashankar m Dec 22 '17 at 6:57
  • can u share you full code? – Abdul Dec 22 '17 at 7:05
  • i shared my code – shivashankar m Dec 22 '17 at 7:08

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.