17
Do you have PHP setup to cache the WSDL files? PHP's SoapServer implementation (used by Magento) needs to examine the WSDL file at least once during a SOAP call, sometimes more than once. This can create exponential growth in your request times. Check the setting at
System -> Configuration -> Magento Core Api -> Enable WSDL Cache
and make sure ...
answered Mar 20 '13 at 19:12
Alan Storm
42.6k3030 gold badges146146 silver badges333333 bronze badges
17
Apparently I fell prey to a common Magento pitfall, so I'm posting the answer in case anyone else is searching this particular error. Basically, the error was coming from the Magento installation I was trying to call via the SOAP API.
Initially I thought the error was generated by the client being unable to locate this definitions result, however the real ...
15
Background
It is not possible with the out-of-box API alone; documentation seems pretty clear on this as it documents no way of establishing selections, options for a bundle
Aside from that, the lack of an api.xml file in the Mage_Bundle package is telling that there is no support. Contrast that with another product type which arrived after 1.0, such as ...
14
I finally found the reason for the problem and the solution:
The problem: SOAPv2 with WS-I does not use the single_data and multi_data attributes. Therefore the check in /app/code/core/Mage/Catalog/Model/Product/Api/V2.php in _prepareDataForSave fails.
The method _prepareDataForSave checks for single_data and multi_data which are both not part of the SOAP-...
14
Same error with another extension here. system.log says
Argument 1 passed to
Mage_Api_Model_Server_Handler_Abstract::processingMethodResult() must
be of the type array, string given, called in
app/code/core/Mage/Api/Model/Server/Handler/Abstract.php...
I think the problem is the new method
Mage_Api_Model_Server_Handler_Abstract::...
12
Custom data interface should be created to represent key-value pairs, e.g.
<?php
namespace Vendor\Module\Api\Data;
/**
* Interface which represents associative array item.
*/
interface AssociativeArrayItemInterface
{
/**
* Get key
*
* @return string
*/
public function getKey();
/**
* Get value
*
* @...
11
You should be able to change this in 'System' -> 'Configuration' -> 'Magento Core API'. The default is 3600 seconds (1 hour).
11
You will need to define a clear use-case to get a specific answer to your question. Unless we have a detailled use-case here, I'd like to answer with general advice on that:
SOAP vs REST
SOAP and REST are two ways of accessing web-services.
SOAP uses XML for its requests. REST relies on HTTP requests via URL and is therefore really lightweight compared to ...
10
Inject \Magento\Framework\Webapi\Soap\ClientFactory in the class where you need it:
public function __construct(\Magento\Framework\Webapi\Soap\ClientFactory $soapClientFactory)
{
$this->soapClientFactory = $soapClientFactory;
}
Then use it to instantiate a SoapClient instance:
$soapClient = $this->soapClientFactory->create($wsdl, $options);
...
answered May 4 '17 at 12:19
Fabian Schmengler
63.3k2323 gold badges169169 silver badges394394 bronze badges
9
I ended up doing something like the following in my data-install-1.0.0.php script, which creates a new role and user with 'all' privileges.
$api_key = "your_key_here";
$api_role = Mage::getModel('api/roles')
->setName('<module>')
->setPid(false)
->setRoleType('G')
->save();
Mage::getModel('api/rules')
...
9
Alan, you are right, SOAP framework is completely different from the one in Magento 1 and was created specifically for Magento 2 needs to have Service layer interfaces same for REST, SOAP and PHP clients.
SOAP Authentication uses oAuth 2.0-like style of authentication using Bearer token. This is simple example on how to configure the SOAP client on PHP side:...
8
Diagnose
Look up the following inside your script file
phpinfo();
If you can't find Soap Client set to enabled like so:
Fix
Do the following:
Locate php.ini in your apache bin folder, I.e Apache/bin/php.ini
Remove the ; from the beginning of extension=php_soap.dll
Restart your Apache server
Look up your phpinfo(); again and check if you see a similar ...
8
The street field contains street1 and street2 separated by a line break. In order to get one or the other just explode the string by \n.
$street = explode('\n', $street);
You can then just pull $street[0] for street1 or $street[1] for street2. Alternatively if you are accessing the customer address object you can just call street1 or street2 directly to ...
7
When using an observer for the event controller_action_postdispatch_contacts_index_post you can access the Post-Data via
public function controllerActionPostdispatchContactsIndexPost(Varien_Event_Observer $observer)
{
$data = $observer->getData();
$post = $data['controller_action']->getRequest()->getPost();
}
To listen for the event create ...
7
This is an already known and patched Magento Bug.
Magento Install Page Displays After SOAP v2 Index Page Refresh
Patch name: SUPEE-3762. Refreshing the SOAP v2 index page
(http://your-magento-host-name/index.php/api/v2_soap/index/) results
in all administrators and customers viewing the Magento installation
page.
http://www.magentocommerce.com/...
7
Facing same issue on ubuntu OS + PHP7 I managed to solve this issue by running this command
sudo apt-get install php7.0-soap
And then restart apache
sudo service apache2 restart
Hope this may help someone.
With php5.x you can you can use
sudo apt-get install php5-soap
7
I've done this for importing group prices with SOAPv2 for Magento CE 1.7.0.2 some time ago and wrote a a (german) blogpost about this (Google translate might help).
I added the important parts with an english explanation here and hope this helps you getting started.
Basically you need to rewrite the catalog/product_api_v2 model and extend the ...
7
SOAP V1: http://magentohost/index.php/api/soap/?wsdl (this one is more like RPC, no concrete operations defined in WSDL, just call)
SOAP V2: http://magentohost/index.php/api/v2_soap?wsdl=1 . For strongly-typed languages use this one and remember to enable WS-I compliance mode on Magento side: Services > Magento Core API > WS-I Compliance to Yes
6
Create A Custommodule:
Api File(Api.php)
<?php
class Amit_Customapi_Model_Api extends Mage_Api_Model_Resource_Abstract
{
public function myregion()
{
$countryList = explode(',', Mage::getStoreConfig(general/region/state_required));
return $countryList;
}
}
and etc/api.xml is
<?xml version="1.0"?...
answered Aug 22 '14 at 8:24
6
The problem you're experiencing is that .NET/C# is having trouble parsing the content type Magento is sending along with it's response. SOAP is notoriously finicky about receiving just the right stuff in just the right format. Couple that with PHP's rather poor implementation of the protocol and you're in for a lot of fun.
I'm looking at a Magento 1.9 for ...
6
SOAP server needs to be initialized with WSDL to understand how to process incoming requests (it basically loads WSDL from the specified URL in case of Magento). This happens in \Mage_Api_Model_Server_Adapter_Soap::_instantiateServer():
$this->_soap = new Zend_Soap_Server(
$this->getWsdlUrl(array("wsdl" => 1)),
array('encoding' => $...
6
You will get all the customer address related attributes by calling below url :
http://yourwebsite.com/index.php/rest//V1/attributeMetadata/customerAddress/
Method Name : GET
Same way for Authorization Bearer youraccesstoken
You will get the all the address related attributes name and its values like state , country etc.
Their you will find ...
5
In a SOAP web service, a WSDL file is the file that describes all the methods available in the service. This information is structured in such a way that the SoapClient will know the XML is needs to send to make the method calls.
The cryptic error message
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't find in 'https:/...
answered Oct 18 '13 at 6:24
Alan Storm
42.6k3030 gold badges146146 silver badges333333 bronze badges
5
The full workflow should be like this:
Create a shopping cart ('cart.create')
Set the customer/guest to the shopping cart ('cart_customer.set')
Set customer addresses, for example guest's addresses ('cart_customer.addresses')
add/update/remove products to the shopping cart ('cart_product.add', 'cart_product.update', cart_product.remove')
get the list of ...
5
A full backup is always recommended during any upgrade attempt. You should also make sure to do the upgrade in a dev/staging system first and test for errors.
The move from EE 1.12 -> 1.13 can be a bit tricky for some (depending on size of stores, etc). There are changes to the way url keys are handled. You need to make sure all of your url keys are ...
5
Simple error. You are using the wrong variable in SalesOrderInfo.
Your current code
Notice: That you set the session Id to $session, but then use $sessionId in salesOrderInfo.
<?php
$proxy = new SoapClient('http://www.mydomain.com/index.php/api/v2_soap?wsdl=1');
$session = $proxy->login('user', 'password'); // connect to the API
$result = $...
5
you need to enable php soap client. Go to your php.ini file and find
extension=php_soap.dll
and remove semicolon(;) , restart your apache. check phpinfo() to see if soap is installed succcessfully.
5
If you are sure that your product exists could it be that you do want to pass a numeric SKU (e.g. 1234)?
If you cast the product ID/SKU to a string, it looks like a number and you don't declare the identifierType "sku", the product identifier will be treated like a ID and so the product won't be found.
The solution: after the data array, add a store ...
5
I got the answer by replacing this
http://127.0.0.1/index.php/api/v2_soap/";
by
http://machines Ip address/index.php/api/v2_soap/";
and I started to use V2 soap api. Its working fine.
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
soap × 477api × 240
magento-1.9 × 125
magento2 × 74
soap-api-v2 × 67
rest × 35
magento-1.7 × 33
wsdl × 30
magento-1.8 × 28
php × 24
web-services × 17
product × 14
soap-api-v1 × 14
orders × 12
customer × 11
xml × 11
magento-2.1 × 10
cart × 9
magento-enterprise × 9
filter × 9
shipping × 8
ce-1.7.0.2 × 8
magento-1 × 7
magento2.3 × 6
module × 6