Convert C# to Xojo

  1. 3 months ago

    Gary S

    Jan 21 St Augustine FL

    My vendor sent me the example below in C#.NET
    Can anyone help me convert this info to Xojo. I have it working by sending XML via Soap with HTTPsocket but can only send one part number at a time. I would like to use the item.Requests.ToArray() so that I can send multiple part numbers at time.
    I appreciate any help.

    Sample C#.NET Code using wsdl class generated from Microsoft’s wsdl.exe class generator.
    protected void PriceAvailability()
    {
    TVHMain.TVHWSpassport passport = new TVHMain.TVHWSpassport();
    passport.version = TVHMain.TVHWSversions.V110;
    passport.accesskey = "Mypasskey";
    passport.account = "MyAccount";
    passport.requestkey = "my request";
    TVHMain.TVHWSpa_request pa_request = new TVHMain.TVHWSpa_request();
    pa_request.passport = passport;
    List<TVHMain.TVHWSitem_request> itemRequests = new List<TVHMain.TVHWSitem_request>();
    TVHMain.TVHWSitem_request itemRequest = new TVHMain.TVHWSitem_request();
    itemRequest.id = "1";
    itemRequest.itemnumber = "sy188";
    itemRequest.quantity = 1;
    itemRequest.reference = "myreference1";
    itemRequest.wh = 1;
    itemRequests.Add(itemRequest);
    pa_request.items = itemRequests.ToArray();
    TVHMain.TVHWSpa_response pa_response = TVHMainWebService.tvhMain.GetPriceAndAvailability(pa_request);
    String request_requestkey = pa_response.requestkey;
    List<TVHMain.TVHWSitem_response> itemsResponses = pa_response.pa.ToList();
    foreach (TVHMain.TVHWSitem_response itemResponse in itemsResponses)
    {
    TVHMain.TVHWSitem_request reqItem = itemResponse.reqitem;
    String id = reqItem.id;
    String itemNumber = reqItem.itemnumber;
    Int32 quantity = reqItem.quantity;
    String reference = reqItem.reference;
    Int32 requestWH = reqItem.wh;
    String reqItemNumber = itemResponse.item.itemnumber;
    List<TVHMain.TVHWSattribute> itemAttributes = itemResponse.item.attributes.ToList();
    foreach (TVHMain.TVHWSattribute itemAttribute in itemAttributes)
    {
    String name = itemAttribute.name;
    String value = itemAttribute.value;
    }
    List<TVHMain.TVHWSinv> invs = itemResponse.inv.ToList();
    foreach (TVHMain.TVHWSinv inv in invs)
    {
    Int32 qty = inv.qty;
    Int32 wh = inv.wh;
    }
    TVHMain.TVHWSprice price = itemResponse.price;
    Decimal itemPrice = price.itemprice;
    Decimal corePrice = price.coreprice;
    Decimal listPrice = price.listprice;
    String currency = price.currency;
    List<TVHMain.TVHWSqtybreak> qbreaks = price.qtybreaks.ToList();
    foreach (TVHMain.TVHWSqtybreak qbreak in qbreaks)
    {
    Int64 qtyCount = qbreak.qtycount;
    Decimal qtyPrice = qbreak.price;
    }
    TVHMain.TVHWSerror itemError = itemResponse.itemerror;
    if (itemError != null)
    {
    String code = itemError.code;
    String description = itemError.description;
    }
    }
    List<TVHMain.TVHWSerror> errors = pa_response.errors.ToList();
    foreach (TVHMain.TVHWSerror error in errors)
    {
    String code = error.code;
    String description = error.description;
    }
    }

or Sign Up to reply!