我正在尝试通过acumatica上的网络服务保存客户数据。但是我收到了这个错误:
SoapFault对象 ( [message:protected] => System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---> System.NullReferenceException:未将对象引用设置为对象的实例。 在PX.Api.SyImportContext.ParseCommand(SyCommand cmd) 在PX.Api.SyExportContext.a(SYMappingField A_0) at System.Linq.Enumerable.WhereSelectArrayIterator
2.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source) 在PX.Api.SyExportContext..ctor(SYMapping mapping,IEnumerable1 fields, String[] providerFields, Dictionary
2 viewFilters,Boolean breakOnError,Int32 start,Int32 count,LinkedSelectorViews selectorViews,String rowFilterField) 在PX.Api.ScreenUtils.Submit(String screenId,Command []命令,SchemaMode schemaMode,PXGraph& graph,String& redirectContainerView,String& redirectScreen,Boolean mobile,Dictionary2 viewFilters) at PX.Api.Services.ScreenService.Submit(String id, IEnumerable
1个命令,SchemaMode schemaMode,Boolean mobile, PXGraph& forceGraph,String& redirectContainerView,String& redirectScreen,Dictionary2 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 :(得分:0)
您应将状态设置为“暂停”的“H”。这是一个char领域。 Acumatica中的大部分下拉都是值和描述符字段的组合。