using file-serializer --> [No error message provided.]

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

using file-serializer --> [No error message provided.]

Nafise
Hi,

I tried to copy a file specified with a URL from one location to the other, by using the URL generator and the File serializer.

here's my copy.xpl:

        <p:param name="data" type="output"/>
       
       
        <p:processor name="<b>oxf:url-generator">
                <p:input name="config">
                        <config>
                                <url>file:/c:/Temp/origin.xml</url>
                        </config>
                </p:input>
                <p:output name="data" id="<b>origin-data"/>
        </p:processor>
       
       
        <p:processor name="<b>oxf:file-serializer">
                <p:input name="config">
                        <config>
                                <directory>c:/Temp</directory>
                                <file>copy.xml</file>
                                <make-directories>true</make-directories>
                                <append>false</append>                       
                        </config>
                </p:input>
                <p:input name="data" href="<b>#origin-data"/>
                <p:output name="data" id="<b>sthToPreventError"  ref="data"/>
        </p:processor>

(As it maybe explicit I have added an extra output because "The processor output must be connected")

browing http://localhost:8080/newOrbeon/xforms-samplecopy/ according to <page path-info="/xforms-samplecopy/"  model="copy.xpl"/> , a java.lang.NullPointerException has Occurred with no messege.


Before this, I was refering logo.jpg & copy.jpg instead of origin.xml & copy.xml. As you may know, the error messege was "Invalid byte 1 of 1-byte UTF-8 sequence." .

So, what's wrong?!

Thanks in Advance.
NAfise
Reply | Threaded
Open this post in threaded view
|

Re: using file-serializer --> [No error message provided.]

Alessandro Vernet
Administrator
Nafise,

On Jan 21, 2008 1:36 AM, Nafise <[hidden email]> wrote:
> (As it maybe explicit I have added an extra output because "The processor
> output must be connected")

If you specify the name of the file you are writing to, you don't want
to have an output declared in the file-serializer. You would use an
output only if you want the file serializer to write to a temporary
file, in which case you would get the URI of the temporary file in the
"data" output. In you case, the maybe the processor doesn't run at all
if you are not reading the "data" output of your pipeline.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: using file-serializer --> [No error message provided.]

Nafise
>If you specify the name of the file you are writing to, you don't want
>to have an output declared in the file-serializer.

Yes, I'd like to specify the name of the file I am writing to. as below:
copy.xpl:
        <p:processor name="oxf:url-generator"> 
                <p:input name="config"> 
                        <config> 
                                <url>file:/c:/Temp/origin.xml</url> 
                        </config> 
                </p:input> 
                <p:output name="data" id="origin-data" /> 
        </p:processor> 
       
         
        <p:processor name="oxf:file-serializer"> 
                <p:input name="config"> 
                        <config> 
                                <directory>c:/Temp</directory> 
                                <file>copy.xml</file> 
                                <make-directories>true</make-directories> 
                                <append>false</append> 
                        </config> 
                </p:input> 
                <p:input name="data" href="#origin-data"/> 
        </p:processor> 

but the result is : "The processor output must be connected"

>In you case, the maybe the processor doesn't run at all if you are not reading the "data" output of your >pipeline.

Then, is it a must to have "data" output in each pipeline?! Actually, I don't need it if I could configure file-serializer to write the file to the path I've specified.
Besides, I have just a page-flow.xml containing <page path-info="/xforms-samplecopy/"  model="copy.xpl"/>.  Did I forget something?


Thank you so much for the attention you pay :)
NAfise

Reply | Threaded
Open this post in threaded view
|

Re: using file-serializer --> [No error message provided.]

Alessandro Vernet
Administrator
Nafise,

On Jan 21, 2008 11:05 PM, Nafise <[hidden email]> wrote:
> [...]
> but the result is : "The processor output must be connected"

Good catch: this is a bug. It was introduced recently, with the
improvement to the file serializer to support temporary files. This is
now fixed, and you can find below the link to the bug for reference.
You can get this in the next nightly build. Let us know if it works
for you when you get a chance to test this.

http://forge.objectweb.org/tracker/index.php?func=detail&aid=308325&group_id=168&atid=350207

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: using file-serializer --> [No error message provided.]

Nafise
Alex,

Here's what I've tested :

1:
origin.xml :
hi

error messege: "Root element must contain as xsi:type"
seems reasonable, but it creates an empty copy.xml too.

2.
origin.xml :
<document xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
hi
</document>

copy.xml:
hi


3.
origin.xml:
<document xsi:type="xs:string" content-type="image/jpeg"  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
/9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ...
KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q==
</document>

copy.xml:
/9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ...
KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q==


4.the good news :
adding <content-type>image/*</content-type> (or suprisingly other content-type in url-generator such as <content-type>application/msword</content-type>) , you can copy the .tmp file from server temporary folder to a .jpg file somewhere else. (assuming that you have uploaded a .jpg ;) )

5.
origin.xml:
<document xsi:type="xs:string" content-type="image/jpeg"  xmlns:xs="http://www.w3.org/2001/XMLSchema" 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
R0lGODlhxwAqANUAAAAAAP///2ZmmXBwn3l5ppmZzIODrIyMs5aWuaCgv6mpxrOzzLy808bG2dDQ
39nZ5uPj7Ozs8/b2+enUtvPl0f/26f+UAOKUJ9mqaNy3g925iOHEm+SVNvHx8eTk5NbW1szMzMnJ
ybu7u66urpOTk////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAADHACoAQAb/wIBw
SCwaj8ikcslsOp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jC5xBbMhHRIPNLDAxA6YC2t4ETiwQIv4QiAxxRY7EfHEC1Q8xcggPxEBThJsQnGzUZQk
wAgfpOQBCPPOBE0sJimgqJnBZMGTegwYy8ugSaQ50wBrwsozLz7L+UwovAT7BAUaOcGwSUTGM8B9
RkRDyFJrjWpkaSx9yoCIYk+iaCgDWF3uaHLB4TXY0HRGYVVoYUh2PE1CceWdUHgQnRCj7V1JPKuG
6fYRnRgJc9fDIv64EkVn0XgAiU/eIONFBP0qKn46UWk52j6R8zqcY9G0Ex6VqtORkGch/3dbnhDh
XrWLdCYA3pYL8DpnWJQazOhHjHZiEacjlLrWbIwbV4tSNFKZ0ED+WD0Wb00PoppIeL89WZA2MacR
jS20QZ5LgGuvch+V+WYxjSKRcE6btZmkZMvD74WZcLKVpKZ1hDoVZn1O2AW7iHA/osyvckAJmJt+
5z/2JAoMEpzKm84XOgEyL1caUEwBK7ABDgzwdkq4RqiS4JcpqDCAanCKFLQhhRfCkHd8IyCdsGUn
Ex7BPSELX/EqhDQjuKd/R4hLqdwzvCgAsS9DLF9gPFiE9PFQfbByD/KOECsECIuCnYrHFsM2Gi8S
QQLu2dwSGKEMNEaRCV3soA5JN0fmXZvkigjxihIiYwDeOcBrBgKgEjqDlyT8kTRIUpKmOtENPvoR
kHTEoRTBcUc8WiAD7PODr05SSD9A0JBG40UnlXDIpRWRGJs0ySjlKEkhcPAIg+PhBZ73BAgsIAEH
yKUCGBDEBtUBiRDLQy4PsEtgBhOXuuRlFGyJTGIqEzIKaIDnahLNaRYBa7nSo8K2Ga9aYKCSFuBA BiiQSSQEAQA7
</document>

error messege: "unknown protocol: c"
and it makes an empty copy.jpg too. the difference between 5th test and the 3th one is that copy.xml has been changed to copy.jpg and whether applying <content-type> or not, the result would be the same.


Best Regards,
NAfise

Reply | Threaded
Open this post in threaded view
|

Re: using file-serializer --> [No error message provided.]

Alessandro Vernet
Administrator
Nafise,

On Jan 23, 2008 6:59 AM, Nafise <[hidden email]> wrote:
> Here's what I've tested :
> [...]

Are you using the XML converter? The File serializer expects documents
in the binary or text format
(http://www.orbeon.com/ops/doc/reference-formats). So if you want to
write an XML document you need to serialize it first. Your XPL will
look something like this:

<p:processor name="oxf:url-generator">
    <p:input name="config">
        <config>
            <url>file:/Users/avernet/Desktop/gaga.xml</url>
        </config>
    </p:input>
    <p:output name="data" id="origin-data"/>
</p:processor>

<p:processor name="oxf:xml-converter">
    <p:input name="config">
        <config>
            <encoding>utf-8</encoding>
        </config>
    </p:input>
    <p:input name="data" href="#origin-data"/>
    <p:output name="data" id="converted"/>
</p:processor>

<!-- Write to another file -->
<p:processor name="oxf:file-serializer">
    <p:input name="config">
        <config>
            <directory>/Users/avernet/Desktop</directory>
            <file>copy.xml</file>
            <make-directories>true</make-directories>
            <append>false</append>
        </config>
    </p:input>
    <p:input name="data" href="#converted"/>
</p:processor>

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws