Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Problem writing files with EnsLib.EDI.XML.Operation.FileOperation, %f is ignored

Question
Erik Svensson · Sep 14, 2018

Problem writing files with EnsLib.EDI.XML.Operation.FileOperation, %f is ignored

Hi,

I have very recently started to work with Ensemble and have both the 2014 and the 2017 version. 

To learn, I have created a small test flow that takes an xml file using EnsLib.EDI.XML.Service.FileService, sends it to a Process that transforms it with xslt into another format, and then passes it onwards to a EnsLib.EDI.XML.Operation.FileOperation Business Operation. 

This is the code that I have before and when sending it onwards:

set tStatus=##class(%XML.XSLT.Transformer).TransformStreamWithCompiledXSL(xmlStreamObj, tCompiledStyleSheet, .pOutput, err)
If $$$ISERR(tStatus) quit tStatus
if $$$ISERR(err) quit err
Do tCompiledStyleSheet.%Close()

Do pOutput.Rewind()
set xmlResultDoc=##class(EnsLib.EDI.XML.Document).ImportFromLibraryStream(pOutput, .tStatus)
If $$$ISERR(tStatus) quit tStatus

set tStatus=..SendRequestSync(..TargetConfigName,xmlResultDoc,.pResponse)

And this is how the settings on the BO looks like:

(I also tried adding a \ to the end of the file path)

This is the error message I get

ERROR <Ens>ErrGeneral: Failed to open for (over)write 'E:\Integration\labb\destination\ : <NOTOPEN>zopen+13 ^EnsLib.File.OutboundAdapter.1

It seems that Ensemble ignores the %f even though the help instructions on the field says it's supported. I tried this in both Ensemble 14 and 17. 

If I add a filename to the "File Path" field, it works and the file is created with the translated content, however, this is not a good solution since it requires me to predetermine the file name when creating the endpoint rather than dynamically taking the file name from the incoming file.

version: 2017.2.1.801.3

Am I doing it wrong or is it a bug in the FileOperation?

#Beginner #XML #Ensemble

Source URL:https://community.intersystems.com/post/problem-writing-files-enslibedixmloperationfileoperation-f-ignored