2017-01-25 5 views
0

私はacumaticaのWebサービスを介して顧客データを保存しようとしています。しかし、私はこのエラーを取得しています:PHPを使用してAcumatica ERPでWebサービス経由でデータを保存する方法

以下

SoapFault Object ( [message:protected] => System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at PX.Api.SyImportContext.ParseCommand(SyCommand cmd) at PX.Api.SyExportContext.a(SYMappingField A_0) at System.Linq.Enumerable.WhereSelectArrayIterator 2.MoveNext() at System.Collections.Generic.List 1..ctor(IEnumerable 1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable 1 source) at PX.Api.SyExportContext..ctor(SYMapping mapping, IEnumerable 1 fields, String[] providerFields, Dictionary 2 viewFilters, Boolean breakOnError, Int32 start, Int32 count, LinkedSelectorViews selectorViews, String rowFilterField) at PX.Api.ScreenUtils.Submit(String screenId, Command[] commands, SchemaMode schemaMode, PXGraph& graph, String& redirectContainerView, String& redirectScreen, Boolean mobile, Dictionary 2 viewFilters) at PX.Api.Services.ScreenService.Submit(String id, IEnumerable 1 commands, SchemaMode schemaMode, Boolean mobile, PXGraph& forceGraph, String& redirectContainerView, String& redirectScreen, Dictionary 2 viewFilters) at PX.Api.Services.ScreenService.Submit(String id, IEnumerable 1 commands, SchemaMode schemaMode) at PX.Api.Soap.Screen.ScreenGate.Submit(Command[] commands)

は私のコードです:

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

Acumatica 5.3または6.0で作業していますか? – RuslanDev

+0

私はAcumatica 5.3で作業しています –

答えて

0

あなたがオン・ホールドのための「H」に自分のステータスを設定する必要があります。これは1つの文字フィールドです。 Acumaticaのドロップダウンのほとんどは、値フィールドと記述フィールドの組み合わせです。

関連する問題