Reputation: 1117
I've run in to the somewhat famous "product not exists" error when trying to get product information from magento using the v2 API. However, none of the usual remedies seem to work. For instance, I checked this thread: magento soap api v2 catalogProductInfo not working
Here is my request data:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:catalogProductInfo>
<sessionId xsi:type="xsd:string">291b294f0a5ec652069dfbd2ba1f42a3</sessionId>
<productId xsi:type="xsd:string">917</productId>
</ns1:catalogProductInfo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here's what I've tried so far:
What's next?
Upvotes: 1
Views: 3113
Reputation: 2072
I had the same problem, and in my case it was due to an update of Magento from 1.7 to 1.9. They changed the WSDL for catalogProductInfo (among other changes). I access the API with auto-generated C# code, and I had to update it (in Visual Studio: right click on the API and "Update Service Reference").
(this wouldn't normally be worth an answer, excepted when you're not notified of the server upgrade, you can search for quite a while before understanding what happened, so I hope this can help someone else)
Upvotes: 0
Reputation: 1610
I am accessing a magento API using C# and SOAP.
I had this same problem (Product not exists) and the solution for me was to leave the last parameter productIdentifierType
as null
or ""
.
details = service.catalogProductInfo(sessionId, prod.sku, null, null, "");
or
details = service.catalogProductInfo(sessionId, prod.product_id, null, null, "");
The documentation seems to say you should put "sku" or "product_id" (or "product" as I have seen others say), but this did not work for me.
You can use either the sku
or the product_id
as your second argument.
The space after the sku (as others have suggested) was not necessary.
Upvotes: 2
Reputation: 1117
I found a solution: it turns out that the magento documentation on http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalog_product.info.html is wrong. The parameter "productId" is actually called "product". So my working code is:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:catalogProductInfo>
<sessionId xsi:type="xsd:string">291b294f0a5ec652069dfbd2ba1f42a3</sessionId>
<product xsi:type="xsd:string">917</product>
</ns1:catalogProductInfo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Where do I report errors in the documentation?
Upvotes: 4