pixiImportFindXML
Returns the most recent XML import log entry for an order (by ORDER_ID) or an item (by SUPPLIER_AID).
Searches the XML import log C_XMLLog for the latest entry that contains a given ID and returns it with request, response and status information.
- If
Idis empty orNULL, a status row withStatusCode400 is returned and nothing else happens. Typeis compared case-insensitively:order: looks up the operation typeOrderImportinC_OperationTypesand searches log entries whoseXmlResponseXmlcontains anORDER_IDelement (at any depth) whose value equalsId.item: looks up the operation typeItemImportand searches for anSUPPLIER_AIDelement (at any depth) whose value equalsId.- Any other value returns a status row with
StatusCode400.
- Additional filters for both types:
- If
Channelis given, only entries with thatChannelRefare considered; if it isNULL, all channels are searched. - Entries with
Status=XNIare excluded.
- If
- The result is sorted by
XMLLogKeydescending and only the first row (the newest matching log entry) is returned. If no entry matches, the result set is empty.
Notes
- All reads use
NOLOCK, so uncommitted log entries may be returned. - The ID match is an exact string comparison against the element value inside
XmlResponseXmlusing an XPathexist()with a descendant search (//). This is evaluated for every candidate log row and can be slow on large log tables; usingChannelnarrows the search. - The
Idcheck happens before theTypecheck, so an emptyIdalways yields the ID error message even ifTypeis invalid. - If the operation type
OrderImportorItemImportdoes not exist inC_OperationTypes, no rows are returned. - The meaning of the status value
XNIis not defined in the code. Responseis the XML columnXmlResponseXmlconverted tovarchar(max).
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
Type
Required
|
varchar(10) string |
– |
Kind of import to search in (case-insensitive). Allowed values
Example: |
Id
Required
|
varchar(50) string |
– |
Value to search for: the order ID ( Example: |
Channel
|
int | NULL |
Optional channel key ( Example: |
Result set 1 · If Id is empty or NULL, or if Type is neither order nor item
Status row describing the validation error.
| Column | Type | Description |
|---|---|---|
StatusCode
|
int |
Always 400. |
StatusMessage
|
varchar(55) string |
Error text. |
Result set 2 · If Id is set and Type is order or item; zero or one row
The newest matching XML import log entry.
| Column | Type | Description |
|---|---|---|
XMLLogKey
|
int |
Key of the log entry in |
Request
Nullable |
string |
Original import request ( |
Response
Nullable |
varchar(max) string |
Content of |
Status
Nullable |
string |
Processing status of the log entry (never |
CreateDate
Nullable |
dateTime |
Creation time of the log entry. |
UpdateDate
Nullable |
dateTime |
Last update time of the log entry. |
Error
Nullable |
string |
Error information stored for the import. |
XmlResponseCastErrorNr
Nullable |
int |
Error number from converting the response to XML, if any. |
XmlResponseCastErrorMessage
Nullable |
string |
Error message from converting the response to XML, if any. |
Response example
<SqlRowSet1>
<row>
<XMLLogKey>58231</XMLLogKey>
<Request><ORDER>...</ORDER></Request>
<Response><ORDER><ORDER_HEADER><ORDER_INFO><ORDER_ID>100004711</ORDER_ID></ORDER_INFO></ORDER_HEADER></ORDER></Response>
<Status>OK</Status>
<CreateDate>2024-03-12T10:15:22</CreateDate>
<UpdateDate>2024-03-12T10:15:25</UpdateDate>
<Error/>
<XmlResponseCastErrorNr>0</XmlResponseCastErrorNr>
<XmlResponseCastErrorMessage/>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| 400 | You have to specify an ID to search for | `Id` is empty or `NULL`. Pass a non-empty order ID or supplier article number. |
| 400 | You have to specify XML type (either "order" or "item") | `Type` is neither `order` nor `item`. Pass one of these two values. |
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:pixiImportFindXML>
<Type>order</Type>
<Id>100004711</Id>
<!-- <Channel>3</Channel> -->
</ns1:pixiImportFindXML>
</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:pixiImportFindXML>
<Type>order</Type>
<Id>100004711</Id>
<!-- <Channel>3</Channel> -->
</ns1:pixiImportFindXML>
</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 = [
'Type' => 'order',
'Id' => '100004711',
// 'Channel' => '3',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiImportFindXML', $soapArguments);
- SQL object:
- dbo.pipiImportFindXML