XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Bruce CantorSubject: path problem, xps_file:writeAll
Author: Bruce Cantor
Date: 18 Apr 2023 01:35 PM
Hello everyone,

I'm currently having an issue with my xquery script not being able to save a file to a UNC path.
I'm using the function xps_file:writeAll(x,y) from the namespace xps_file = "ddtekjava:com.ivitechnologies.pipeline.ext.io.FileOperations" to write a text file, and I'm getting the path from a config file.

The script works fine when I write to a local disk, but the file isn't being written when I use the UNC path, even though the function returns true without any errors.

I've tried different variations of the UNC path, but I'm not having any luck in getting the file to the correct location.

Any advice or suggestions would be greatly appreciated.
How do I write the UNC path correctly so that the file is written to the correct place?

Thank you for your help in advance!

Postnext
Ivan PedruzziSubject: path problem, xps_file:writeAll
Author: Ivan Pedruzzi
Date: 18 Apr 2023 05:06 PM
Can you show how you are formatting the UNC path in XQuery?


Ivan Pedruzzi
Stylus Studio Team

Postnext
Ivan PedruzziSubject: path problem, xps_file:writeAll
Author: Ivan Pedruzzi
Date: 18 Apr 2023 05:37 PM

The following UNC format works in our test suite

\\computername\sharename\filename

if the write fails you should see an error in the server log


Ivan Pedruzzi
Stylus Studio Team

Postnext
Bruce CantorSubject: path problem, xps_file:writeAll
Author: Bruce Cantor
Date: 19 Apr 2023 09:40 AM
Hi Ivan,
I can make the pipeline work on my local PC with the suggested path, but not on the pipeline server.

My conf. where second line works on server, but first line does not work on server, works on local PC.


<BankTransactions>


<!-- <OutGoingFilesExchangeURI>\\file\eet\G1-FINANCE-NAVI-INTEGRATION\JyskeBankTest\Navi_1_ReadyToImport\</OutGoingFilesExchangeURI> -->
<OutGoingFilesExchangeURI>file:///C:/tmp/BanktransactionTest/</OutGoingFilesExchangeURI>
</BankTransactions>

Postnext
Ivan PedruzziSubject: path problem, xps_file:writeAll
Author: Ivan Pedruzzi
Date: 19 Apr 2023 03:10 PM
Bruce,

this is a file path
\\file\eet\G1-FINANCE-NAVI-INTEGRATION\JyskeBankTest\Navi_1_ReadyToImport\

this is a URL
file:///C:/tmp/BanktransactionTest/


If you want to express UNC as URL you need to use the format below
Assuming that "file" is the server name and "eet" is the share name.

file://///file/eet/G1-FINANCE-NAVI-INTEGRATION/JyskeBankTest/Navi_1_ReadyToImport/

There are 5 forward slash characters after "file:".


Ivan Pedruzzi
Stylus Studio Team

Postnext
Ivan PedruzziSubject: path problem, xps_file:writeAll
Author: Ivan Pedruzzi
Date: 19 Apr 2023 03:10 PM
Bruce,

this is a file path
\\file\eet\G1-FINANCE-NAVI-INTEGRATION\JyskeBankTest\Navi_1_ReadyToImport\

this is a URL
file:///C:/tmp/BanktransactionTest/


If you want to express UNC as URL you need to use the format below
Assuming that "file" is the server name and "eet" is the share name.

file://///file/eet/G1-FINANCE-NAVI-INTEGRATION/JyskeBankTest/Navi_1_ReadyToImport/

There are 5 forward slash characters after "file:".


Ivan Pedruzzi
Stylus Studio Team

Postnext
Bruce CantorSubject: path problem, xps_file:writeAll
Author: Bruce Cantor
Date: 20 Apr 2023 08:27 AM
HI Ivan

I have tried with the five slashes but that does not result in a file either.

I know the server has the rights to write to this directory, because I could write via a pipeline Output port.
And if I add a debug port in the bindings file, it results in a file written to exactly this directory.

But I needed to change the way the file was written because the user demanded a special name for the file.

Currently I have these configs:

Binding file:

<port name="XqueryOutput" protocol="file" folderFullPath="\\file\eet\G1-FINANCE-NAVI-INTEGRATION\JyskeBank\Navi_1_ReadyToImport"/>

Config file used to write the converted file:

<BankTransactions>
<OutGoingFilesExchangeURI>file://///file/eet/G1-FINANCE-NAVI-INTEGRATION/JyskeBankTest/Navi_1_ReadyToImport/</OutGoingFilesExchangeURI>
</BankTransactions>

The 'XqueryOutput' writes a file with 'true' as content, but the converted file never shows up in the same directory.

What can the problem possible be?

Postnext
Ivan PedruzziSubject: path problem, xps_file:writeAll
Author: Ivan Pedruzzi
Date: 20 Apr 2023 04:49 PM
Bruce,

If there was an I/O error you would get stack-trace in the server log.

If file system port binding works on UNC. the extension function should work also because they run in the same security context.

Assuming that there no I/O error, I see two possibilities:

1) the UNC path you are passing is resolved somewhere else from where you are expecting it

2) the code with the UNC is not executed

Can you output the full file path you are passing to function FileOperations.writeall in some file on the server

What happens if use ddtek:serialize-to-url instead of FileOperations.writeall ?

let $my_UNC_url := ....
return ddtek:serialize-to-url('true', $my_UNC_url, 'method=text')





Ivan Pedruzzi
Stylus Studio Team

Posttop
Bruce CantorSubject: path problem, xps_file:writeAll
Author: Bruce Cantor
Date: 21 Apr 2023 11:26 AM
Hi Ivan,

I wanted to let you know that the issue has been resolved. It turns out that the five slashes were the key to resolving the problem. The other issues that were encountered were due to user error. Thank you for providing your support.

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.