Bill Creation using SOAP fails

  • 7 October 2020
  • 2 replies
  • 159 views

Creating a Bill document with all fields populated using SOAP results in error “System.InvalidOperationException: Cant find method for action \"http://www.acumatica.com/entity/3/DefaultRLSFT/17.200.001/Put\"\n   at System.Monads.ArgumentCheck.CheckNull[TSource](TSource source, Func`1 exceptionSource)\n   at PX.Api.ContractBased.Soap.WebApiSoapController.<Login>d__6.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1`1.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\n--- End of stack trace from previous lo
cation where exception was thrown ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()”

This error happens on both default EndPoint and extended Endpoint, which includes item InventoryID

 

Any help will be appreciated.

 


2 replies

Userlevel 4
Badge

Please post your sample code using default end point that is failing.

Here is the code:

            string lcSQL, lcErrMsg, lcStage = "Start";

 

clsGlobals.gcAcmtURL="http://localhost/AcumaticaERP/";
clsGlobals.gcAcmtEndPoint="Default";
clsGlobals.gcAcmtVersion="17.200.001";

 

 

            AcmtIntegrator.AcumaticaWSDL.DefaultSoapClient soapClient = null;
            soapClient = new AcmtIntegrator.AcumaticaWSDL.DefaultSoapClient(clsACMT.CreateBinding(clsGlobals.gcAcmtURL),
            clsACMT.CreateEndpoint(clsGlobals.gcAcmtURL, clsGlobals.gcAcmtEndPoint, clsGlobals.gcAcmtVersion));

            string lcBranch, lcLocationID;
 

            // Bill Level:
            lcBranch = "SOFT";
            lcLocationID = "";
            string docType = "Bill";
            string lcVendorCd = "EP00000001";
            string lcVendorRef = "VendorRef - 2";
            decimal lnBillAmt = 1000;
            string lcDocTxnDate = "20201005", lcDocDueDate = "20201104";
            string lcCashAccount = "102000SOFT";
            string lcBillDesc = "bill Desc 2";
            string lcRefNo = "RefNo";
            string lcTerms = "30D";
            string lcPostPeriod = "102020";


            int lnLineCount = 0;
            lnLineCount = 1;

            // Bill Line
            decimal lnLineExtAmt = 1000, lnUnitCost = 0, lnLineQty = 0;
            string lcLinePOOrderNbr = "", lcLinePOOrderType = "", lcLineDesc = "Line Desc", lcLineTranDesc = "Tran Desc";
            string lcLineAccount, lcLineSubAccount, lcUoM, lcLineItemInvID, lcLineProject = "Prj", lcLineProjectTask = "PTask";
            string lcItemAcmtGuid = "61594ca1-0d6b-e411-a445-e06995c86014";

            //

            BillDetail[] loBillDetails;
            loBillDetails = new BillDetail[lnLineCount];

 

            lcLineItemInvID = "ADVERT";
            lcLineDesc = "Advertising";
            lcLineAccount = "610000";
            lcLineSubAccount = "0000000";
            lcUoM = "HOUR";


            loBillDetails[0] = new BillDetail
            {
                Branch = new StringValue { Value = lcBranch },
                Amount = new DecimalValue { Value = lnLineExtAmt },
                ExtendedCost = new DecimalValue { Value = lnLineExtAmt },
                UnitCost = new DecimalValue { Value = lnUnitCost },
                Qty = new DecimalValue { Value = lnLineQty },
                TransactionDescription = new StringValue { Value = lcLineTranDesc },
                Description = new StringValue { Value = lcLineDesc },
                POOrderNbr = new StringValue { Value = lcLinePOOrderNbr },
                POOrderType = new StringValue { Value = lcLinePOOrderType },
                Account = new StringValue { Value = lcLineAccount },
                Subaccount = new StringValue { Value = lcLineSubAccount },
                // InventoryID = new StringValue { Value = lcLineItemInvID },
                UOM = new StringValue { Value = lcUoM },
                Project = new StringValue { Value = lcLineProject },
                ProjectTask = new StringValue { Value = lcLineProjectTask }
        };

 

            Bill loBill = new Bill
            {
                ReturnBehavior = ReturnBehavior.OnlySpecified,
                // ReturnBehavior = ReturnBehavior.All,
                Amount = new DecimalValue { Value = lnBillAmt },
                Applications = new AcmtIntegrator.AcumaticaWSDL.BillApplicationDetail[0],
                ApprovedForPayment = new BooleanValue { Value = true },
                Balance = new DecimalValue { Value = lnBillAmt },
                BranchID = new StringValue { Value = lcBranch },
                CashAccount = new StringValue { Value = lcCashAccount },    
                CurrencyID = new StringValue { Value = "USD" },
                CustomFields = new AcmtIntegrator.AcumaticaWSDL.CustomField[0],
                Description = new StringValue { Value = lcBillDesc },
                Hold = new BooleanValue { Value = false },
                Note = "",  
                Type = new StringValue { Value = docType },
                ReferenceNbr = new StringReturn { Value = lcRefNo },
                // ReferenceNbr = new StringReturn(),
                TaxDetails = new AcmtIntegrator.AcumaticaWSDL.BillTaxDetail[0],
                // Type = new StringValue (),  
                // Status = new StringReturn(),
                Status = new StringReturn { Value = "Balanced" },
                Vendor = new StringValue { Value = lcVendorCd },
                VendorRef = new StringValue { Value = lcVendorRef },
                PostPeriod = new StringValue { Value = lcPostPeriod },
                TaxTotal = new DecimalValue { Value = 0 },  
                Terms = new StringValue { Value = lcTerms },
                Details = loBillDetails,
            };

            // LocationID is optional
            if (lcLocationID != "")
            {
                loBill.LocationID = new StringValue { Value = lcLocationID };
            }

            if (lcDocTxnDate != "")
            {
                loBill.Date = new DateTimeValue
                {
                    Value = new DateTime(Convert.ToInt32(mdlGU.MyLeft(lcDocTxnDate, 4)),
                    Convert.ToInt32(lcDocTxnDate.Substring(4, 2)),
                    Convert.ToInt32(lcDocTxnDate.Substring(6, 2)))
                };

                loBill.DueDate = new DateTimeValue
                {
                    Value = new DateTime(Convert.ToInt32(mdlGU.MyLeft(lcDocDueDate, 4)),
                    Convert.ToInt32(lcDocDueDate.Substring(4, 2)),
                    Convert.ToInt32(lcDocDueDate.Substring(6, 2)))
                };

            };

            //Create a Bill
            Bill newBill = new Bill();
            try
            {
                newBill = (Bill)soapClient.Put(loBill);
            }
            catch (Exception ex)
            {
                lcErrMsg = ex.Message.Replace("'", "").Substring(0, 900);
            }

 

 

            soapClient.Logout();

Thank you!

I checked that a copy of an existing Bill can be saved by Put, so there is no issue with permissions to save.

The only Nulls that I could find in loBill were ID and RowNumber.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved