pixiImportProcessXML
Processes an imported item or order XML from C_XMLLog immediately (parse, check and apply to main tables) instead of waiting for the SQL Agent import job.
Triggers the processing of one imported XML, identified by XMLLogKey, right away.
- Validation: the XML must exist in
C_XMLLog, its operation type (C_OperationTypes.OperationType) must beItemImportorOrderImport, and itsStatusmust be one ofCOC,ERR,NEI,XER,XIMorXPA. Otherwise a status row withReturnCode=ERROR APIis returned. - Item XML (
ItemImport):- If the application lock
PixiItemImportis currently held (the item import agent job is running), only the parse stepPixi_C_ParseAndCheckXMLsFromItemImportis executed for this XML, and the call ends with anERROR APIrow saying the XML is already in process and has been parsed. - Otherwise the call takes the lock itself, runs the parse/check step and then
Pixi_C_ApplyItemsToMainTablesfor this XML, and releases the lock.
- If the application lock
- Order XML (
OrderImport): same logic with lockPixiOrderImport, the parse stepPixi_C_ParseAndCheckXMLsFromOrderImportand the apply stepPixi_C_ApplyOrdersToMainTables. - At the end a status row with
ReturnCode=OKis returned.
All called procedures run with the user name API.
Because the called procedures return their own rows, the caller receives several result sets: the Success row of the parse step, possibly rows of the apply step, and finally the ReturnCode/ErrorMessage status row. Always evaluate the last result set for the outcome.
Notes
- Errors in parse/apply are swallowed: the parse and apply steps run in an inner
TRY/CATCHthat only releases the application lock. If one of them fails, the call still returnsReturnCode=OK. CheckC_XMLLog.Status/Errorafterwards to verify the real result. - The informational message
XML with XMLLogKey {XMLLogKey} has been processed.is raised with severity 1 and may appear asSqlMessage; it is not an error. - In the "already in process" case the XML has been parsed although
ReturnCodeisERROR API. - The application locks
PixiItemImport/PixiOrderImport(session owner) are shared with the SQL Agent import jobs; while the call holds the lock, the agent job cannot process at the same time. - The called procedures respect the settings
C_ItemImportEnabled,C_ItemImport_ParseAndCheckData_Enabled,C_OrderImportEnabled,C_OrderImport_ParseAndCheckData_Enabled,C_OrderImport_ApplyToMainTables_Enabledand per-channel-type settings. If they are disabled, the steps do nothing, but the call still returnsOK. - The parse steps only parse XMLs of channel type
URLwhoseErrorcolumn is empty. XMLs of channel typesPlentyRESTorShipRushare only reset to statusXIM(withAttemptsToProcess= 0) so that the Integration Service parses them again. - The parse steps also do global work (e.g.
pixi_C_UpdateXMLsAsParsed, exchange rate import for orders), and the order apply step callsPixi_AmazonOrdersMarkOrders. - The setting
C_ParseAndImportDataIntervalMinutesis read but not used. Pixi_C_ApplyItemsToMainTablesis not attached; its exact behaviour and returned rows are unknown.- Existence and status checks use
NOLOCK.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
XMLLogKey
Required
|
int | – |
Key of the imported XML in Example: |
Result set 1 · If the XML is valid and the import parse settings are enabled (returned by the parse procedure)
Confirmation row of the parse/check step (Pixi_C_ParseAndCheckXMLsFromItemImport or Pixi_C_ParseAndCheckXMLsFromOrderImport).
| Column | Type | Description |
|---|---|---|
Success
|
varchar(7) string |
Constant |
Result set 2 · If the lock was free and the apply step returns rows (orders: when apply settings are enabled; items: unknown)
Rows of the apply step. Pixi_C_ApplyOrdersToMainTables returns one Success row; the output of Pixi_C_ApplyItemsToMainTables is not known.
| Column | Type | Description |
|---|---|---|
Success
|
varchar(7) string |
Constant |
Result set 3 · Always, as the last result set
Status row with the overall result of the call.
| Column | Type | Description |
|---|---|---|
ReturnCode
|
varchar(9) string |
|
ErrorMessage
Nullable |
nvarchar(4000) string |
On success |
Response example
<SqlRowSet1>
<row>
<Success>Success</Success>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| ERROR API | XML with XMLLogKey {XMLLogKey} does not exist or has not the right status or type of XML. Only XMLs in Status COC, ERR, NEI, XER, XIM or XPA and Item / Order XMLs can be (re-)processed. - pipiImportProcessXML | The XML does not exist, is not an `ItemImport`/`OrderImport` XML, or its status is not one of the allowed values. Check the key and the status in `C_XMLLog`. |
| ERROR API | XML with XMLLogKey {XMLLogKey} already in process by import. Has been parsed. - pipiImportProcessXML | The import agent job (or another call) currently holds the lock `PixiItemImport` or `PixiOrderImport`. The XML was only parsed; it will be applied by the running import, or the call can be repeated later. |
| ERROR API | {error message} - {procedure name} | Any other SQL error outside the inner parse/apply block, e.g. an error raised by the parse procedure in the "already in process" branch or by releasing the lock. |
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiImportProcessXML>
<XMLLogKey>123456</XMLLogKey>
</ns1:pixiImportProcessXML>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiImportProcessXML>
<XMLLogKey>123456</XMLLogKey>
</ns1:pixiImportProcessXML>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
'XMLLogKey' => '123456',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiImportProcessXML', $soapArguments);
- SQL object:
- dbo.pipiImportProcessXML