I am implimenting a custom solution to interface with a Magento website. My code is in C#. I am trying to create products using either the v2_soap api and the xml-rpc api web services. I have attempted to create a product using both services. I cannot seem to successfully create a product. With each service I receive the error message “ [102] Invalid data given. Details in error message.”. I have tried passing in a variety of data to the api call, but have not had any luck. I am wondering a few things:
1) Is there any way to recieve better error messages about what data is not valid when I make a web service call? The error message seems to indicate that I can get “details” somewhere, but I have searched through all logs, error message data I can find with no luck.
2) What are the minimum attributes required to add a new product using the web service?
Here is a bit of the code I am using. This is the XML-RPC implimentation. I am using the cook computing xml-rpc library.
public int CreateProduct(Product product) {
var entity = ConvertProduct(product);
//int productId = Service.catalogProductCreate(SessionId, "simple", "0", product.Sku, entity);
int productId = XmlRpcService.CallReturnInt(SessionId, "catalog_product.create",
new object[] {
"simple" /* product type */,
0 /* attribute set */,
product.Sku /* sku */,
entity /* product data */
});
return productId;
}
private XmlRpcStruct ConvertProduct(Product product) {
var entity = new XmlRpcStruct();
entity.Add("name", product.Name);
entity.Add("description", product.Description);
return entity;
}
protected IMagentoXmlRcpService XmlRpcService {
get {
return this.xmlRpcService;
}
}