IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

C# XSLT Result Options · View
rjswider
Posted: Thursday, March 3, 2016 7:37:49 PM
Rank: Member

Joined: 3/18/2005
Posts: 6
Location: US
I'm using the text-in/text-out methods from C# to run a simple xslt against an xml file. It works correctly in XMLSpy, but when I execute ExecuteAndGetResultAsString(), the result I get is "additional-files:///file1 - OK". The only reference I can find that deals with 'additional-files' has to do with zipped files or additional referenced files/resources. This is a simple xslt transform that should return a short chunk of xml. Am I using it incorrectly? The LastErrorMessage property is empty, so I think executed correctly.
island
Posted: Friday, March 4, 2016 8:32:21 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Are you using 2015r4 of RaptorXML? If so upgrade to the latest version and see if the problem still exists.

If it still exists in the latest version then post your c#code snippet as well as the source xml and xslt.



rjswider
Posted: Friday, March 4, 2016 1:44:29 PM
Rank: Member

Joined: 3/18/2005
Posts: 6
Location: US
I'm using RaptorXML 2016. I'm not sure of the build, but I just downloaded it yesterday, so I assume it's the most recent release. I've simplified my code a bit, and the data and xslt are just demo data, but I still get the same result from the server. Incidentally, I checked the server logs, and I see the call come in. No errors are logged:

10.0.1.99 - - [04/Mar/2016:09:13:45] "POST /v1/queue HTTP/1.1" 201 111 "" "RaptorXMLServer/1.1 (COM interface)"
10.0.1.99 - - [04/Mar/2016:09:13:45] "GET /v1/results/F29323A2-9189-44AF-8BFA-E24A1B40EA33 HTTP/1.1" 200 66 "" "RaptorXMLServer/1.1 (COM interface)"
10.0.1.99 - - [04/Mar/2016:09:13:46] "GET /v1/results/F29323A2-9189-44AF-8BFA-E24A1B40EA33 HTTP/1.1" 200 524 "" "RaptorXMLServer/1.1 (COM interface)"
10.0.1.99 - - [04/Mar/2016:09:13:46] "DELETE /v1/results/F29323A2-9189-44AF-8BFA-E24A1B40EA33 HTTP/1.1" 200 - "" "RaptorXMLServer/1.1 (COM interface)"


Code:
void PerformTransform()
        {
            string source = LoadDoc(@"D:\Temp\SourceData.xml");

            string transform = LoadDoc(@"D:\Temp\RaptorTest.xslt");

            string result = CallServer(transform, transform);
        }

        string LoadDoc(string path)
        {
            string docContent = string.Empty;

            using (StreamReader reader = new StreamReader(path))
            {
                docContent = reader.ReadToEnd();
            }

            return docContent;
        }

        string CallServer(string sourceDoc, string xsltDoc)
        {
            objRaptorXMLServer = new Server();
            objRaptorXMLServer.ServerName = "asrtransform";
            objRaptorXMLServer.ServerPort = 8087;
            objRaptorXMLServer.ReportOptionalWarnings = true;

            XSLT xslEngine = objRaptorXMLServer.GetXSLT();

            xslEngine.InputXMLFromText = sourceDoc;
            xslEngine.XSLFromText = xsltDoc;

            return xslEngine.ExecuteAndGetResultAsString();
        }


Source Doc:
Code:
<root>
    <thing>PMXP0048194932-1</thing>
    <thing>PMXP0048194932-2</thing>
    <thing>PMXP0048194932-3</thing>
    <thing>PMXP0048194932-4</thing>
    <thing>PMXP0048194932-5</thing>
    <thing>PMXP0048194932-6</thing>
    <thing>PMXP0048194932-7</thing>
    <thing>PMXP0048194932-8</thing>
    <thing>PMXP0048194932-9</thing>
    <thing>PMXP0048194932-10</thing>
    <thing>PMXP0048194932-11</thing>
    <thing>PMXP0048194932-12</thing>
    <thing>PMXP0048194932-13</thing>
    <thing>PMXP0048194932-14</thing>
    <thing>PMXP0048194932-15</thing>
    <thing>PMXP0048194932-16</thing>
    <thing>PMXP0048194932-17</thing>
    <thing>PMXP0048194932-18</thing>
    <thing>PMXP0048194932-19</thing>
    <thing>PMXP0048194932-20</thing>
    <thing>PMXP0048194932-21</thing>
</root>


XSLT:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
    <xsl:template match="/">
        <xsl:element name="root">
            <xsl:for-each select="//thing">
                <xsl:element name="thingContainer">
                    <xsl:value-of select="."/>
                </xsl:element>
            </xsl:for-each>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>
rjswider
Posted: Friday, March 4, 2016 3:03:22 PM
Rank: Member

Joined: 3/18/2005
Posts: 6
Location: US
As an update, I put the compiled project on the server where RaptorXML is installed and ran it from there with the same data and transform. The result I get back is "<root/>". I'm confused by this. It seems to be reading my data correctly, but still doesn't produce the expected output. I just thought it was odd that I get different (though not correct) result running it local on the server. Logged data appears to be the same.
rjswider
Posted: Tuesday, March 22, 2016 2:07:06 PM
Rank: Member

Joined: 3/18/2005
Posts: 6
Location: US
It took a while, and several back-and-forth messages to Altova Support, but I have the fix, for anyone else who encounters it:

On the server, in the server_config.xml file, change the server.unrestricted-filesystem-access option to false.

It is set to true by default. Once you change the value, restart the RaptorXML service, and you should now get the correct result.

Altova support is still looking at whether this is intended behavior or a bug, so the underlying issue is still a mystery, but changing the config definitely fixed the problem.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.