- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018
02:46 AM
07-05-2018
02:46 AM
Ciao a tutti, sto cercando di modificare dei prodotti tramite api. Facendo una chiamata soap su un singolo prodotto (sto provando a disabilitarlo), funziona tutto correttamente, ma se provo con un ciclo a ripetere l'azione per n prodotti successivi ottengo come errore 403 SoapFault Forbidden.
Ho provato a chiudere e riaprire la sessione ma l'errore persiste.
Nei log di Apache leggo 'client denied by server configuration: /var/www/magento/httpdocs/api'.
Qualcuno ha incontrato un problema simile?
Grazie!
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018
05:27 AM
07-05-2018
05:27 AM
Hello @PaolaM
$client = new SoapClient('http://example.com/index.php/api/soap/?wsdl'); $session = $client->login('xxxx', 'xxxxx'); // $productInfo is array which contains all product sku and its quantities which will update to another server $productInfo = array( array('sku'=>'sku1','qty'=>'50000'), array('sku'=>'sku2','qty'=>'110'), ); $start = microtime(true); foreach($productInfo as $product ) { $calls[] = array('product_stock.update', array($product['sku'], array('qty'=>$product['qty']))); } /* 2 products will go in one request to another server for product update stock data(in my case quantities) using SOAP API multiCall method IF YOU HAVE LOTS OF PRODUCT FOR UPDATE TO ANOTHER SERVER THEN YOU CAN REPLACE VALUE IN array_chunk function(in my case 2) 2 is total products data */ foreach(array_chunk($calls, 2) as $skuChunk) { $result = $client->multiCall($session, $skuChunk); } echo $time_elapsed_secs = microtime(true) - $start; // How many times will be elapsed for this operation
Hope it will help you.
If works then mark as the solution or give kudos.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018
05:27 AM
07-05-2018
05:27 AM
Hello @PaolaM
$client = new SoapClient('http://example.com/index.php/api/soap/?wsdl'); $session = $client->login('xxxx', 'xxxxx'); // $productInfo is array which contains all product sku and its quantities which will update to another server $productInfo = array( array('sku'=>'sku1','qty'=>'50000'), array('sku'=>'sku2','qty'=>'110'), ); $start = microtime(true); foreach($productInfo as $product ) { $calls[] = array('product_stock.update', array($product['sku'], array('qty'=>$product['qty']))); } /* 2 products will go in one request to another server for product update stock data(in my case quantities) using SOAP API multiCall method IF YOU HAVE LOTS OF PRODUCT FOR UPDATE TO ANOTHER SERVER THEN YOU CAN REPLACE VALUE IN array_chunk function(in my case 2) 2 is total products data */ foreach(array_chunk($calls, 2) as $skuChunk) { $result = $client->multiCall($session, $skuChunk); } echo $time_elapsed_secs = microtime(true) - $start; // How many times will be elapsed for this operation
Hope it will help you.
If works then mark as the solution or give kudos.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018
08:04 AM
07-05-2018
08:04 AM
Re: Magento 1 Soap 403 Forbidden
It works, thank you!