Could anyone advise on what I might be doing wrong.
I am currently writing a c# class library to integration with v2 of the SOAP API on a vanilla install version 1.3.2 of Magento, it has the standard Main Website, English, French, German site views. I tried the NET C# Object Library for Magentoâs XML-RPC API but as the products have a variable number of properties that isn’t known at runtime, and there doesn’t seem to to be a way to build up the product object at runtime I reverted to coding my own against the SOAP api. After some hacking of the WSDL I am able to create a web reference and proxy code to use in my class library.
I am able to create a product. In this example I create a catalogProductCreateEntity with a string sku = “1234”, visibility is Catalog and Search, status is enabled and it published to Main Website. I do this by passing the appropriate values and the catalogProductCreateEntity to the catalogProductCreate method of the SOAP API. This seems to work fine. I can see the product on the ‘Manage Catalog’ section of the website.
Now I need to do the ‘if product exists update, else create functionality’.
I first tried to use the catalogProductInfo method, passing sessionID, a string sku = “1234”, a string “default” for store view (I also tried different options here such as “English"/"French"/"German"/"Admin"/1/2/3) a catalogProductRequestAttributes object with one attribute name ="sku" (I also tried variations here as well), and a string “simple” for the product type. When I run this I recieve 101 error, “product not exists” ( shouldn’t this be “product does not exist").
So I then try the catalogProductList method, passing a filter with one entity having the key = “sku” and value = “1234”, along with sessionId and a string = “default” for store view. Calling this method successfully returns me an array of catalogProductEntity containing my product with sku = “1234”.
Strange, first method says “product not exists”, second method say “product does exists, here is your product”. However it lets me do what I need so I only have to do the last step, update the product if it exists.
For this I use the catalogProductUpdate method on the SOAP API. I pass sessionID, a string = “1234” for sku, the same catalogProductCreateEntity, a string = “simple” for product type and string = “default” for product type. What I get back is the same 101 error, “product not exists” that I got when calling the catalogProductInfo method. ARRRGGGGHHH!!! I know the product exists because magento gave it to me when I called catalogProductList.
I’m banging my head against the wall here. Things I consider I maybe doing wrong are that I don’t really understand what the catalogProductRequestAttributes is used for when calling the catalogProductInfo. I presume it constrains the data that is returned but maybe I’m wrong and I need to do something else with it. Also maybe there is something with store view that I don’t understand.
If anyone has similar experiences or can offer advice I would be grateful.