skip to Main Content

What is the equivalent of this for VB.NET?

$filters = array('sku' => array('like'=>'zol%'));

$products = $proxy->call($sessionId, 'product.list', array($filters));

Because I am trying to retrieve a specific product from Magento by doing something like this:

Dim products = magentoV1_servico.call(magentoV1_sessao, "product.list", filters)

All I get is an error message saying “Error creating XML file”. I’m guessing my filters are wrong, because I’m not sure how to send those array parameters correctly. I’m using Magento 1.9, SOAP API v1.

2

Answers


  1. I couldn’t access the WSDL, but by the looks of things the .Net signature should be this:

    Dim filters As New List(Of String, List(Of KeyValuePair(Of String, String)))()
    

    Maybe a Dictionary should be used instead of List, but from the examples on their page it looks like duplicates are supported. Check the WSDL and play around with these techniques if this isn’t spot on.

    The translation of your specific filters from the question would be created like this:

    Dim filter1 As New List(Of KeyValuePair(of String, String))
    filter1.Add(New KeyValuePair("like", "zol%"))
    
    filters.Add("sku", filter1)
    
    Login or Signup to reply.
  2. I faced with the same problem after trying to use a lot of different Object in V1 of Magento. Always the same “Error creating XML file” problem.

    As we need to work with complex object that should be serialized I even try with

    SerializableDictionary<TKey, TValue> Class
    

    , but with no luck. In this case the problem was during compilation, the “Microsoft.WindowsServerSolutions.Administration.ObjectModel.dll is damaged”.

    I’ve bypassed my issue using Magento SOAP V2 that actually doesn’t need an associative array for the request I was needing.

    Another possible solution is to provide a SerializibleDictonary for your own as descripted in guides like this one or this one but I didn’t find the time to test it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search