Hi Method,
Not sure if my question is ok in this forum or in General Q&A, I put it here first since it is about WebAPI.
1. In my Purchase Order Screen, when I insert an POLineItem, I customize its behavior, so it will insert two extra records to my other tables in addition to new record to PurchaseOrderLine. (That is, there are three "Insert record to table" actions been executed.)
2. Since the way done in (1) is very slow, it took about 2 - 4 seconds to make it. (I tested it by insert 10 items in a loop.) So, we are thinking if we can get some performance improvement if we change this part in WebAPI. So, we did it by calling MethodAPIInsertV2. And it is done in PHP with a Apache server. The result is actually even worse, every item takes 4-6 seconds, which is almost double compared to Method Action.
3. The same scenario done in a local VB program, performance is stil the same as PHP version, which is slow compared to Method Action.
Just wondering if this kind of result is as expected (WebAPI insert is slower than Method Action)? If it is as expected, any way we can do to improve performance while using WebAPI? or something wrong I did to call WebAPI?
Thanks.
Alex
-----
my code in PHP
function CreatePurchaseOrderLineItem($CompanyAccount, $Login, $Password, $SessionID, $PORecordID, $Location, $Depot, $ContainerNo, $ItemName, $ItemDescription, $UnitPrice)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://www.methodintegration.com/MethodAPI/service.asmx/MethodAPIInsertV2");
curl_setopt($curl, CURLOP_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$optparam = "strCompanyAccount=" . $CompanyAccount. "&strLogin=" . $Login . "&strPassword=" . $Password. "&strSessionID=" . $SessionID;
$optparam .= "&strTable=PurchaseOrderLine";
$optparam .= "&arrInsertFieldsArray=BICID&arrInsertValueArray=" . $ContainerNo;
$optparam .= "&arrInsertFieldsArray=IEMBICID&arrInsertValueArray=" . $ContainerNo;
$optparam .= "&arrInsertFieldsArray=Item&arrInsertValueArray=" . $ItemName;
$optparam .= "&arrInsertFieldsArray=Desc&arrInsertValueArray=" . $ItemDescription;
$optparam .= "&arrInsertFieldsArray=PurchaseOrderRecordID&arrInsertValueArray=" . $PORecordID;
$optparam .= "&arrInsertFieldsArray=Quantity&arrInsertValueArray=" . "1";
$optparam .= "&arrInsertFieldsArray=Rate&arrInsertValueArray=" . $UnitPrice;
$optparam .= "&arrInsertFieldsArray=IEMItemDepotName&arrInsertValueArray=" . $Depot;
$optparam .= "&arrInsertFieldsArray=IEMItemLocationName&arrInsertValueArray=" . $Location;
$optparam .= "&arrInsertFieldsArray=IEMTransFromDepot&arrInsertValueArray=" . $Depot;
$optparam .= "&arrInsertFieldsArray=IEMTransFromLocation&arrInsertValueArray=" . $Location;
$optparam .= "&arrInsertFieldsArray=QBIEMDepot&arrInsertValueArray=" . $Depot;
$optparam .= "&arrInsertFieldsArray=QBIEMLocation&arrInsertValueArray=" . $Location;
if ($globalDebug)
{
echo $optparam;
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $optparam);
$result = curl_exec($curl);
curl_close($curl);
return CheckErrorAndReturnRecordID($result, -101);
}