[wpkg-users] WPKG running as local system unable to download profiles.xml file
Antony Awaida
antony at apporto.co
Wed Jul 30 22:10:56 CEST 2014
Hi Rainer:
Thanks for your response. I appreciate it.
Before I got your replies, I experimented with an alternate approach: 1) in
a first step, I download the XML files to disk. I then use the regular
WPKG.js code to parse the files and continue processing. You can see the
code further below.
This approach seems to work well and the XML files are correctly written to
disk and then parsed even when WPKG.js is running as Localsystem. However,
for some reason WPKG.js exits with no errors and fails to write the log
file.
for( var i=0; i < filePaths.length; i++) {
var filePath = filePaths[i];
dinfo("Reading XML file: " + filePath);
var xmlHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
xmlHttpReq.open("GET", "https://someurl/xml_out/profiles", false);
xmlHttpReq.send();
//WScript.Echo("XSLT :" + xmlHttpReq.responseText);
var fso, tf;
fso = new ActiveXObject("Scripting.FileSystemObject");
tf = fso.CreateTextFile("c:\\programdata\\bizappcenter\\temp.xml",
true);
tf.Write(xmlHttpReq.responseText);
tf.Close();
// Read XML file from file system.
var xsl = new ActiveXObject("Msxml2.DOMDocument.3.0");
xsl.async = false;
xsl.validateOnParse = false;
/*
var str = "<?xml version=\"1.0\"?>\r\n";
str += "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
xmlns:wpkg=\"" + xmlNamespace + "\" version=\"1.0\">\r\n";
str += " <xsl:output encoding=\"utf-8\" indent=\"yes\" method=\"xml\"
version=\"1.0\"/>\r\n";
str += " <xsl:template match=\"/\">\r\n";
str += " <" + "wpkg:" + rootNodeName + ">\r\n";
str += " <xsl:copy-of select=\"document('" +
filePath +
"')/wpkg:" + rootNodeName + "/child::*\"/>\r\n";
str += " <xsl:copy-of select=\"document('" +
filePath +
"')/" + rootNodeName + "/child::*\"/>\r\n";
str += " </" + "wpkg:" + rootNodeName + ">\r\n";
str += " </xsl:template>\r\n";
str += "</xsl:stylesheet>\r\n";
xsl.loadXML(str);
*/
xsl.load("c:\\programdata\\bizappcenter\\temp.xml");
WScript.Echo("XSLT :" + xsl.xml)
dinfo("XSLT: " + xsl.xml);
On Tue, Jul 29, 2014 at 11:55 PM, Rainer Meier <r.meier at wpkg.org> wrote:
> Hi Antony
>
>
> On 30.07.2014 00:51, Antony Awaida wrote:
>
>> I have identified the problem to be in the following piece of WPKG.js
>> code. So I
>> created the following script:
>>
>> var xsl = new ActiveXObject("Msxml2.DOMDocument.3.0");
>> xsl.async = false;
>> xsl.validateOnParse = false;
>> xsl.load(filePath);
>> dinfo("XSLT: " + xsl.xml);
>>
>> As expected the above script returns an empty xsl.xml when run as
>> LocalSystem.
>> However, when I changed the Msxml2.DOMDocument.3.0 to
>> Msxml2.DOMDocument.6.0,
>> WPKG does not seem to run.
>>
>
> The code uses Microsoft XML framework objects. If you face issues with the
> objects you might try installing latest updates of Microsoft XML Framework.
> Though usually the problem is within authentication on network shares and
> different handling of SYSTEM account regarding network authentication which
> is out of scope for WPKG core development.
>
> I am usually running WPKG using WPKG client which also runs as system
> account but does also take care about proper network share credential setup.
>
> You might try two work-arounds:
>
> 1. Create service user rather than running WPKG service as SYSTEM account.
>
> 2. Instead of launching wpkg.js/cscript.exe directly as a SYSTEM service
> wrap it within a cmd.exe script which handles network authentication and
> credential setup (net use). The script should verify whether files on share
> are properly readable before invoking wpkg.js.
>
>
> Almost certainly your local SYSTEM account faces access denied on the
> network share when connecting to your share. Although this is a guess since
> you neither provide logs nor details on your setup (client type, patch
> level, how credential setup is done, server type, patch level, connection
> logs and traces...).
>
>
> br,
> Rainer
>
--
Antony Awaida
CEO
Apporto (Previously BizAppCenter)
Cell 415 999 4547
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20140730/16176ae2/attachment-0003.html>
More information about the wpkg-users
mailing list