How to export temp table to txt using xmlport

Hi expert.

I want to use xmlport to import data from web service, So I create a xmlport file , then create a codeunit to call this xmlport .

UpdateVehicle(VAR BaseVehicle : XMLport "Import Vehicle";VAR ErrMsg : Text) : Boolean

IF NOT (BaseVehicle.IMPORT) THEN BEGIN //WS1.78 TEST
ErrMsg := 'failed.';
EXIT(FALSE);
END;

BaseVehicle is a xmlport based on Temp table, 

i want to check the imported data, how can i export the transfered-in data ? 

I mean , if xmlport.import is false, how can i save the data to txt for debuging?

Any suggestion will be warmly appreciated.

Parents
  • What did you do before this updateVehicle function?

    I assume that you already have already called your web response and streamed it into NAV? And that's the reason you have BaseVehicle as a VAR var?

    If your import fails, then you need to stream that into a Blob field? Then you can use the FileManagement codeunit to save the file.

    UpdateVehicle(VAR BaseVehicle : XMLport "Import Vehicle";BlobField: Blob; VAR ErrMsg : Text) : Boolean
    IF NOT BaseVehicle.IMPORT THEN BEGIN
        TempBlob.INIT;
        TempBlob.Blob := BlobField;
        FileName := 'WhatEverYouWant.txt';
        FileManagement.BLOBExport(TempBlob,FileName,TRUE);
    END;
    

    Personally I have never used XMLPorts for web services. I know that you could do that, but I have always preferred to have full control, when dealing with web services. Instead I use the build-in/DotNet XMLDom functionality. This way it's possible to give much better feedback to the user towards what went wrong.

Reply Children
No Data
Related
Recommended