Showing results for 
Search instead for 
Did you mean: 

2.0.4 - .NET - catalogInventoryStockRegistryV1PortTypeClient - product not found issue

0 Kudos

2.0.4 - .NET - catalogInventoryStockRegistryV1PortTypeClient - product not found issue

Feature request from lindows-xx, posted on GitHub Apr 02, 2016

hi team,

i'm building a .net integration with magento 2, i noticed when i call the following code to get a product from magento 2,

  1. if the sku exist in magento (ALL OK)
  2. if the sku doesn't exist, the code will error cause the response from magento can't be serialized

`using (catalogInventoryStockRegistryV1PortTypeClient svc = new catalogInventoryStockRegistryV1PortTypeClient(SecureBinding(endPoint), new EndpointAddress(endPoint))) { svc.Endpoint.Behaviors.Add(new MyBehavior());

                using (new OperationContextScope(svc.InnerChannel))
                    // Add a HTTP Header to an outgoing request
                    HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
                    requestMessage.Headers["Authorization"] = String.Format("Bearer {0}", token);
                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;

                    CatalogInventoryStockRegistryV1GetStockItemBySkuResponse r = svc.catalogInventoryStockRegistryV1GetStockItemBySku(new CatalogInventoryStockRegistryV1GetStockItemBySkuRequest()
                        productSku = sku,

                    if (r != null) retVal = r.result;

if the record can't be found (item/product/order/invoice) which ever the record is, instead of returning the fault xml and the reason, return just the response object wihtout the data so that the code could be serialized?

this was great in magento 1, but i feel they trying to do too much in v2 and its causing alot of problems when trying to write integrations

1 Comment
New Member

Comment from piotrekkaminski, posted on GitHub Jun 09, 2016

@mbrinton01 @choukalos can you look into it?