Hi all,
I'm consuming a NAV 2009 web service in another NAV 2009 database by redirecting the XML response to an XMLPort to import records. The target table is empty. There is no code in the XMLPort.
It appears that for certain records the ObBeforeInsertRecord is run twice, which results in the "the record already exists" error.
I save the XML response to a file and check that the records in question only appear once. They do.
Setting the XMLPort record element to temporary didn't help, as well as some "IF record.get(PrimaryKey) then currXMLport.SKIP;" in OnBeforeInsertRecord.
As I'm fairly new to XMLPorts I'm pretty sure I'm missing something obvious and any help would be appreciated.
Unfortunately the response has 10MB an is too large to post here.
I'm consuming a NAV 2009 web service in another NAV 2009 database by redirecting the XML response to an XMLPort to import records. The target table is empty. There is no code in the XMLPort.
It appears that for certain records the ObBeforeInsertRecord is run twice, which results in the "the record already exists" error.
I save the XML response to a file and check that the records in question only appear once. They do.
Setting the XMLPort record element to temporary didn't help, as well as some "IF record.get(PrimaryKey) then currXMLport.SKIP;" in OnBeforeInsertRecord.
As I'm fairly new to XMLPorts I'm pretty sure I'm missing something obvious and any help would be appreciated.
OBJECT XMLport 5315151 Artikel Import Webservice
{
OBJECT-PROPERTIES
{
Date=11.09.17;
Time=12:48:44;
Modified=Yes;
Version List=;
}
PROPERTIES
{
DefaultFieldsValidation=No;
Format/Evaluate=XML Format/Evaluate;
DefaultNamespace=urn:microsoft-dynamics-schemas/codeunit/Test;
UseDefaultNamespace=Yes;
}
ELEMENTS
{
{ [{856F907C-FF78-41F4-923C-01A224C2BE3B}]; ;Envelope ;Element ;Text }
{ [{1116D3CA-D807-4A20-A8C4-57AA968B161D}];1 ;Body ;Element ;Text }
{ [{41017B74-0E93-453F-9213-BD3F46F23B5A}];2 ;ReadItems_Result ;Element ;Text }
{ [{DC532533-B59D-4555-A5CA-32FAD639F39A}];3 ;result ;Element ;Text ;
MinOccurs=Once }
{ [{953DC4D1-5191-44C3-B7B7-1280D1848DF3}];4 ;ExportArtikel ;Element ;Table ;
SourceTable=Table50008;
Temporary=Yes;
MinOccurs=Zero }
{ [{E64D2B94-57E9-49C8-991C-44F9CA43B4F1}];5 ;Nr ;Element ;Field ;
DataType=Code;
FieldValidate=No;
SourceField=Test Artikel::Nr. }
{ [{431731D9-AA6E-45D6-BFCC-F6329A0921A2}];5 ;Nr2 ;Element ;Field ;
DataType=Code;
FieldValidate=No;
SourceField=Test Artikel::Nummer 2 }
{ [{C5B3C344-5503-42CA-9BB5-B921D9AB0A12}];5 ;Beschreibung ;Element ;Field ;
DataType=Text;
FieldValidate=No;
SourceField=Test Artikel::Beschreibung }
.
.
.
this goes on for a couple of dozen fields
.
.
.
{ [{850BC55A-1323-4EB4-9198-030F92C5EF54}];5 ;ModellCode ;Element ;Field ;
DataType=Code;
FieldValidate=No;
SourceField=Test Artikel::Modell Code }
{ [{8C5DE225-6493-4D0A-924D-4832ABF5D852}];5 ;PackageCode ;Element ;Field ;
DataType=Code;
FieldValidate=No;
SourceField=Test Artikel::Package Code }
}
EVENTS
{
}
REQUESTPAGE
{
PROPERTIES
{
}
CONTROLS
{
}
}
CODE
{
BEGIN
END.
}
}
Unfortunately the response has 10MB an is too large to post here.