.net — Как сохранить данные через веб-сервис на Acumatica ERP, используя переполнение стека

Я пытаюсь сохранить данные клиентов через веб-сервис acumatica. Но я получаю эту ошибку:

Объект SoapFault
(
[message: protected] => System.Web.Services.Protocols.SoapException: серверу не удалось обработать запрос. —> System.NullReferenceException: ссылка на объект не установлена ​​для экземпляра объекта.
в PX.Api.SyImportContext.ParseCommand (SyCommand cmd)
в PX.Api.SyExportContext.a (SYMappingField A_0)
в System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
at System.Collections.Generic.List
1..ctor (IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 источник)
в PX.Api.SyExportContext..ctor (сопоставление SYMapping, IEnumerable1 fields, String[] providerFields, Dictionary2 viewFilters, Boolean breakOnError, запуск Int32, счетчик Int32, LinkedSelectorViews selectorViews, String rowFilterField)
в PX.Api.ScreenUtils.Submit (String screenId, Command [] команды, SchemaMode schemaMode, PXGraph& график, строка& redirectContainerView, String& redirectScreen, логический мобильный, словарь2 viewFilters)
at PX.Api.Services.ScreenService.Submit(String id, IEnumerable
1 команда, SchemaMode schemaMode, логический мобильный, PXGraph& ForceGraph, String& redirectContainerView, String& redirectScreen, словарь2 viewFilters)
at PX.Api.Services.ScreenService.Submit(String id, IEnumerable
1 команда, SchemaMode schemaMode)
в PX.Api.Soap.Screen.ScreenGate.Submit (команды Command [])

Ниже мой код:

require_once('AcumaticaGate.php');

$client = new AcumaticaGate("username", "password",'AR303000','http://host/acumatica/Soap');

$schema         = $client->Schema->GetSchemaResult;

$customer           = $schema->CustomerSummary->CustomerID;
$customer_name      = $schema->CustomerSummary->CustomerName;
$customer_status    = $schema->CustomerSummary->Status;
$customer_class     = $schema->GeneralInfoFinancialSettings->CustomerClass;
$cycle_id           = $schema->GeneralInfoFinancialSettings->StatementCycleID;
$credit             = $schema->GeneralInfoCreditVerificationRules->RemainingCreditLimit;
$country            = $schema->GeneralInfoMainAddress->Country;
$sales_account      = $schema->GLAccounts->SalesAccount;
$cash_discount      = $schema->GLAccountsCashDiscountAccount->CashDiscountAccount;

$command = array();
array_push($command, $client->PrepareValue('101923', $schema->CustomerSummary->CustomerID));
array_push($command, $client->PrepareValue('Richard Chambula Test Acc', $customer_name));
array_push($command, $client->PrepareValue('On Hold', $customer_status));
array_push($command, $client->PrepareValue('DEFAULT', $customer_class));
array_push($command, $client->PrepareValue('EOM', $cycle_id));
array_push($command, $client->PrepareValue('Disabled', $credit));
array_push($command, $client->PrepareValue('NA', $country));
array_push($command, $client->PrepareValue('5011', $sales_account));
array_push($command, $client->PrepareValue('8302', $cash_discount));

array_push($command, $schema->Actions->Save);
$submit = new Submit();
$submit->commands = $command;

try
{
$submit_result = $client->Client->Submit($submit);
}
catch(Exception $e)
{
echo "<PRE>";
print_r($e);
}

0

Решение

Вы должны установить свой статус на «H» для удержания. Это одно символьное поле. Большинство раскрывающихся списков в Acumatica представляют собой комбинацию полей значений и дескрипторов.

0

Другие решения

Других решений пока нет …