Decoding base64Binary

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

Decoding base64Binary

Stephen Bayliss
I'm calling a web service (SOAP), and the results are returned as base64Binary.

The results are actually an XML document (this is being encoded by the web service and returned as a base64Binary stream).

I want to decode the base64Binary data back into an XML document so I can process it.

I've tried using the oxf:xml-converter, but with no joy.

For example:
==========
    <p:processor name="oxf:xml-converter">
        <p:input name="config">
            <config>
                <content-type>application/xml</content-type>
                <encoding>utf-8</encoding>
                <version>1.0</version>
            </config>
        </p:input>
        <p:input name="data">
            <document xsi:type="xs:base64Binary">PGRhdGE+ZXhhbXBsZTwvZGF0YT4=</document>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>
==========

In this case, the decoded data is actually:
<data>example</data>

The results of the above are the whole of the data input, as-is, embedded within <document></document> tags.

I can use the oxf:http-serializer processor to stream the base64 data straight to the browser and view the XML that way; but I can't figure out a way of converting it into an XML output that can be consumed by other processors.



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Decoding base64Binary

Taras Bahnyuk
You are not alone,

just see my posts and post from Boon Low.
We don't know how to do anything else with the imported data but stream
it.
And we need help on that.
Welcome to the club.

Cheers,
Taras

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: woensdag 31 augustus 2005 13:44
To: [hidden email]
Subject: [ops-users] Decoding base64Binary

I'm calling a web service (SOAP), and the results are returned as
base64Binary.

The results are actually an XML document (this is being encoded by the
web service and returned as a base64Binary stream).

I want to decode the base64Binary data back into an XML document so I
can process it.

I've tried using the oxf:xml-converter, but with no joy.

For example:
==========
    <p:processor name="oxf:xml-converter">
        <p:input name="config">
            <config>
                <content-type>application/xml</content-type>
                <encoding>utf-8</encoding>
                <version>1.0</version>
            </config>
        </p:input>
        <p:input name="data">
            <document
xsi:type="xs:base64Binary">PGRhdGE+ZXhhbXBsZTwvZGF0YT4=</document>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>
==========

In this case, the decoded data is actually:
<data>example</data>

The results of the above are the whole of the data input, as-is,
embedded within <document></document> tags.

I can use the oxf:http-serializer processor to stream the base64 data
straight to the browser and view the XML that way; but I can't figure
out a way of converting it into an XML output that can be consumed by
other processors.



--
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Decoding base64Binary

Stephen Bayliss
In reply to this post by Stephen Bayliss
I have had some thoughts on how to do this (for my situation anyway)

- Locate a Java utility library that includes base64 decoding (eg
org.apache.axis.encoding.ser.Base64Deserialiser)
- Hook this into OPS by writing a java processor
(http://www.orbeon.com/ops/doc/processors-java)

Not sure if it's suitable for what you are doing.

Steve

-----Original Message-----
From: Taras Bahnyuk [mailto:[hidden email]]
Sent: 31 August 2005 12:54
To: [hidden email]
Subject: RE: [ops-users] Decoding base64Binary

You are not alone,

just see my posts and post from Boon Low.
We don't know how to do anything else with the imported data but stream
it.
And we need help on that.
Welcome to the club.

Cheers,
Taras

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: woensdag 31 augustus 2005 13:44
To: [hidden email]
Subject: [ops-users] Decoding base64Binary

I'm calling a web service (SOAP), and the results are returned as
base64Binary.

The results are actually an XML document (this is being encoded by the
web service and returned as a base64Binary stream).

I want to decode the base64Binary data back into an XML document so I
can process it.

I've tried using the oxf:xml-converter, but with no joy.

For example:
==========
    <p:processor name="oxf:xml-converter">
        <p:input name="config">
            <config>
                <content-type>application/xml</content-type>
                <encoding>utf-8</encoding>
                <version>1.0</version>
            </config>
        </p:input>
        <p:input name="data">
            <document
xsi:type="xs:base64Binary">PGRhdGE+ZXhhbXBsZTwvZGF0YT4=</document>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>
==========

In this case, the decoded data is actually:
<data>example</data>

The results of the above are the whole of the data input, as-is,
embedded within <document></document> tags.

I can use the oxf:http-serializer processor to stream the base64 data
straight to the browser and view the XML that way; but I can't figure
out a way of converting it into an XML output that can be consumed by
other processors.



--

The information contained in this communication and any attachments is
confidential and may be privileged, and is for the sole use of the
intended recipient(s). Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
please notify the sender immediately by replying to this message and
destroy all copies of this message and any attachments. ASML is neither
liable for the proper and complete transmission of the information
contained in this communication, nor for any delay in its receipt.





--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Decoding base64Binary

Erik Bruchez
Administrator
In reply to this post by Taras Bahnyuk
Right now, you have processors that convert:

o Base64 or text to HTTP stream (HTTP serializer)

o Base64 or text to file (File serializer)

o XML to XML, XHTML, HTML to text serialization

There was no processor taking Base64 and converting that to parsed XML,
but since that was easy to implement this is now fixed: there is a new
To-XML Converter which does this job. This is an example of use:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
           xmlns:oxf="http://www.orbeon.com/oxf/processors">

     <p:param type="output" name="data"/>

     <p:processor name="oxf:url-generator">
         <p:input name="config">
             <config>
                 <url>parsing-view.xsl</url>
                 <content-type>binary/octet-stream</content-type>
                 <force-content-type>true</force-content-type>
             </config>
         </p:input>
         <p:output name="data" id="xml-file-as-binary"/>
     </p:processor>

     <p:processor name="oxf:to-xml-converter">
         <p:input name="data" href="#xml-file-as-binary"/>
         <p:input name="config">
             <config/>
         </p:input>
         <p:output name="data" ref="data"/>
     </p:processor>

</p:config>

If you are receiving the Base64 code from a web service, you will have
first to extract the Base64 data and encapsulated it into a <document>
element such as this one:

<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:base64Binary" content-type="binary/octet-stream">
... Base64 ...
</document>

This will be available in the next build:

   http://forge.objectweb.org/nightlybuilds/ops/ops/

-Erik

Taras Bahnyuk wrote:

> You are not alone,
>
> just see my posts and post from Boon Low.
> We don't know how to do anything else with the imported data but stream
> it.
> And we need help on that.
> Welcome to the club.
>
> Cheers,
> Taras
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]
> Sent: woensdag 31 augustus 2005 13:44
> To: [hidden email]
> Subject: [ops-users] Decoding base64Binary
>
> I'm calling a web service (SOAP), and the results are returned as
> base64Binary.
>
> The results are actually an XML document (this is being encoded by the
> web service and returned as a base64Binary stream).
>
> I want to decode the base64Binary data back into an XML document so I
> can process it.
>
> I've tried using the oxf:xml-converter, but with no joy.
>
> For example:
> ==========
>     <p:processor name="oxf:xml-converter">
>         <p:input name="config">
>             <config>
>                 <content-type>application/xml</content-type>
>                 <encoding>utf-8</encoding>
>                 <version>1.0</version>
>             </config>
>         </p:input>
>         <p:input name="data">
>             <document
> xsi:type="xs:base64Binary">PGRhdGE+ZXhhbXBsZTwvZGF0YT4=</document>
>         </p:input>
>         <p:output name="data" ref="data"/>
>     </p:processor>
> ==========
>
> In this case, the decoded data is actually:
> <data>example</data>
>
> The results of the above are the whole of the data input, as-is,
> embedded within <document></document> tags.
>
> I can use the oxf:http-serializer processor to stream the base64 data
> straight to the browser and view the XML that way; but I can't figure
> out a way of converting it into an XML output that can be consumed by
> other processors.
>
>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Decoding base64Binary

Erik Bruchez
Administrator
In reply to this post by Stephen Bayliss
Steve,

Yes this is an option. There are also facilities in OPS to handle
Base64. As mentioned in another post, there is now a To-XML Converter
that does the job.

-Erik

Stephen Bayliss wrote:

> I have had some thoughts on how to do this (for my situation anyway)
>
> - Locate a Java utility library that includes base64 decoding (eg
> org.apache.axis.encoding.ser.Base64Deserialiser)
> - Hook this into OPS by writing a java processor
> (http://www.orbeon.com/ops/doc/processors-java)
>
> Not sure if it's suitable for what you are doing.
>
> Steve
>
> -----Original Message-----
> From: Taras Bahnyuk [mailto:[hidden email]]
> Sent: 31 August 2005 12:54
> To: [hidden email]
> Subject: RE: [ops-users] Decoding base64Binary
>
> You are not alone,
>
> just see my posts and post from Boon Low.
> We don't know how to do anything else with the imported data but stream
> it.
> And we need help on that.
> Welcome to the club.
>
> Cheers,
> Taras
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]
> Sent: woensdag 31 augustus 2005 13:44
> To: [hidden email]
> Subject: [ops-users] Decoding base64Binary
>
> I'm calling a web service (SOAP), and the results are returned as
> base64Binary.
>
> The results are actually an XML document (this is being encoded by the
> web service and returned as a base64Binary stream).
>
> I want to decode the base64Binary data back into an XML document so I
> can process it.
>
> I've tried using the oxf:xml-converter, but with no joy.
>
> For example:
> ==========
>     <p:processor name="oxf:xml-converter">
>         <p:input name="config">
>             <config>
>                 <content-type>application/xml</content-type>
>                 <encoding>utf-8</encoding>
>                 <version>1.0</version>
>             </config>
>         </p:input>
>         <p:input name="data">
>             <document
> xsi:type="xs:base64Binary">PGRhdGE+ZXhhbXBsZTwvZGF0YT4=</document>
>         </p:input>
>         <p:output name="data" ref="data"/>
>     </p:processor>
> ==========
>
> In this case, the decoded data is actually:
> <data>example</data>
>
> The results of the above are the whole of the data input, as-is,
> embedded within <document></document> tags.
>
> I can use the oxf:http-serializer processor to stream the base64 data
> straight to the browser and view the XML that way; but I can't figure
> out a way of converting it into an XML output that can be consumed by
> other processors.
>
>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Decoding base64Binary

Stephen Bayliss
In reply to this post by Stephen Bayliss
Excellent news!
Thanks!
Steve

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]]
Sent: 01 September 2005 01:38
To: [hidden email]
Subject: Re: [ops-users] Decoding base64Binary

Right now, you have processors that convert:

o Base64 or text to HTTP stream (HTTP serializer)

o Base64 or text to file (File serializer)

o XML to XML, XHTML, HTML to text serialization

There was no processor taking Base64 and converting that to parsed XML,
but since that was easy to implement this is now fixed: there is a new
To-XML Converter which does this job. This is an example of use:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
           xmlns:oxf="http://www.orbeon.com/oxf/processors">

     <p:param type="output" name="data"/>

     <p:processor name="oxf:url-generator">
         <p:input name="config">
             <config>
                 <url>parsing-view.xsl</url>
                 <content-type>binary/octet-stream</content-type>
                 <force-content-type>true</force-content-type>
             </config>
         </p:input>
         <p:output name="data" id="xml-file-as-binary"/>
     </p:processor>

     <p:processor name="oxf:to-xml-converter">
         <p:input name="data" href="#xml-file-as-binary"/>
         <p:input name="config">
             <config/>
         </p:input>
         <p:output name="data" ref="data"/>
     </p:processor>

</p:config>

If you are receiving the Base64 code from a web service, you will have
first to extract the Base64 data and encapsulated it into a <document>
element such as this one:

<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:base64Binary" content-type="binary/octet-stream">
... Base64 ...
</document>

This will be available in the next build:

   http://forge.objectweb.org/nightlybuilds/ops/ops/

-Erik

Taras Bahnyuk wrote:
> You are not alone,
>
> just see my posts and post from Boon Low.
> We don't know how to do anything else with the imported data but
stream

> it.
> And we need help on that.
> Welcome to the club.
>
> Cheers,
> Taras
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]
> Sent: woensdag 31 augustus 2005 13:44
> To: [hidden email]
> Subject: [ops-users] Decoding base64Binary
>
> I'm calling a web service (SOAP), and the results are returned as
> base64Binary.
>
> The results are actually an XML document (this is being encoded by the
> web service and returned as a base64Binary stream).
>
> I want to decode the base64Binary data back into an XML document so I
> can process it.
>
> I've tried using the oxf:xml-converter, but with no joy.
>
> For example:
> ==========
>     <p:processor name="oxf:xml-converter">
>         <p:input name="config">
>             <config>
>                 <content-type>application/xml</content-type>
>                 <encoding>utf-8</encoding>
>                 <version>1.0</version>
>             </config>
>         </p:input>
>         <p:input name="data">
>             <document
> xsi:type="xs:base64Binary">PGRhdGE+ZXhhbXBsZTwvZGF0YT4=</document>
>         </p:input>
>         <p:output name="data" ref="data"/>
>     </p:processor>
> ==========
>
> In this case, the decoded data is actually:
> <data>example</data>
>
> The results of the above are the whole of the data input, as-is,
> embedded within <document></document> tags.
>
> I can use the oxf:http-serializer processor to stream the base64 data
> straight to the browser and view the XML that way; but I can't figure
> out a way of converting it into an XML output that can be consumed by
> other processors.
>
>
>
>
>
>
------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws






--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Decoding base64Binary

bsteuhl
In reply to this post by Erik Bruchez
Erik,

I am have a mental block on something.  I am uploading a document and storing it into MySQL database as base64Binary successfully using combination of xsl, url, identity and sql processor.  I then want users to be able to download the document and I need to convert or decode the base64Binary and I thought this code would work but it just returns the same base64Binary stored in MySQL:  So I grab the base64Binary data, wrap it in a document element with appropriate attributes, and then write that file to a temporary location grabbing the url back in the xForm for user to download.  What part am I missing so that a PDF file stored as base64Binary can be opened back up as a PDF?

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:sql="http://orbeon.org/oxf/xml/sql"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xi="http://www.w3.org/2001/XInclude"
                xmlns:fe="http://example.com/forms/onViewArrest/xform"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <p:param type="input" name="instance"/>
        <p:param type="output" name="data"/>



        <p:processor name="oxf:sql">
                <p:input name="data" href="#instance"/>
                <p:input name="config">
                        <sql:config xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                                <sql:connection>
                                        <sql:datasource>cjpsis</sql:datasource>
                                        <sql:execute>
                                                <sql:query>
                                                        select document from docs where incidentNumber = 'R4';
                                                </sql:query>
                                                <sql:result-set>
                                                        <tempFile>
                                                                <sql:row-iterator>
                                                                        <sql:get-column-value type="xs:base64Binary" column="document"/>
                                                                </sql:row-iterator>
                                                        </tempFile>
                                                </sql:result-set>
                                        </sql:execute>
                                </sql:connection>
                        </sql:config>
                </p:input>
                <p:output name="data" id="file-data"/>
        </p:processor>

        <p:processor name="oxf:xslt"> 
                <p:input name="data" href="#file-data"/> 
                <p:input name="config"> 
                        <xsl:stylesheet version="2.0"> 
                                <xsl:template match="/"> 

                                        <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:base64Binary" content-type="binary/octet-stream">
                                                <xsl:value-of select="."/> 
                                        </document>

                                </xsl:template> 
                        </xsl:stylesheet>
                </p:input> 
                <p:output name="data" id="dynamicFile"/> 
        </p:processor> 

        <p:processor name="oxf:file-serializer">
                <p:input name="config">
                        <config>
                                <scope>session</scope>
                        </config>
                </p:input>
                <p:input nae="data" href="#dynamicFile"/>
                <p:output name="data" ref="data"/>
        </p:processor>

</p:config>

Brian Steuhl
BTM Software Solutions, LLC
Reply | Threaded
Open this post in threaded view
|

Re: Re: Decoding base64Binary

Ethan Gruber
Hi,

Is this typo in the oxf:file-serializer actually in your XPL document:

<p:input nae="data" href="#dynamicFile"/>

I assume it's not because I imagine you might get an error rather than just the base64binary document.

Ethan

On Wed, Sep 28, 2011 at 2:27 PM, bsteuhl <[hidden email]> wrote:
Erik,

I am have a mental block on something.  I am uploading a document and
storing it into MySQL database as base64Binary successfully using
combination of xsl, url, identity and sql processor.  I then want users to
be able to download the document and I need to convert or decode the
base64Binary and I thought this code would work but it just returns the same
base64Binary stored in MySQL:  So I grab the base64Binary data, wrap it in a
document element with appropriate attributes, and then write that file to a
temporary location grabbing the url back in the xForm for user to download.
What part am I missing so that a PDF file stored as base64Binary can be
opened back up as a PDF?

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
       xmlns:sql="http://orbeon.org/oxf/xml/sql"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:oxf="http://www.orbeon.com/oxf/processors"
       xmlns:xi="http://www.w3.org/2001/XInclude"
               xmlns:fe="http://example.com/forms/onViewArrest/xform"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

       <p:param type="input" name="instance"/>
       <p:param type="output" name="data"/>



       <p:processor name="oxf:sql">
               <p:input name="data" href="#instance"/>
               <p:input name="config">
                       <sql:config xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                               <sql:connection>
                                       <sql:datasource>cjpsis</sql:datasource>
                                       <sql:execute>
                                               <sql:query>
                                                       select document from docs where incidentNumber = 'R4';
                                               </sql:query>
                                               <sql:result-set>
                                                       <tempFile>
                                                               <sql:row-iterator>
                                                                       <sql:get-column-value type="xs:base64Binary" column="document"/>
                                                               </sql:row-iterator>
                                                       </tempFile>
                                               </sql:result-set>
                                       </sql:execute>
                               </sql:connection>
                       </sql:config>
               </p:input>
               <p:output name="data" id="file-data"/>
       </p:processor>

       <p:processor name="oxf:xslt">
               <p:input name="data" href="#file-data"/>
               <p:input name="config">
                       <xsl:stylesheet version="2.0">
                               <xsl:template match="/">

                                       <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:base64Binary" content-type="binary/octet-stream">
                                               <xsl:value-of select="."/>
                                       </document>

                               </xsl:template>
                       </xsl:stylesheet>
               </p:input>
               <p:output name="data" id="dynamicFile"/>
       </p:processor>

       <p:processor name="oxf:file-serializer">
               <p:input name="config">
                       <config>
                               <scope>session</scope>
                       </config>
               </p:input>
               <p:input nae="data" href="#dynamicFile"/>
               <p:output name="data" ref="data"/>
       </p:processor>

</p:config>

Brian Steuhl
http://btmsoftwaresolutions.com BTM Software Solutions, LLC

--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Decoding-base64Binary-tp25132p3852365.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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




--
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: Re: Re: Decoding base64Binary

bsteuhl
I did fix that - I think that happended right before I copied.
 
Business Email: [hidden email]
Cell: 908-421-0742
Home Office: 732-961-3187
Google Voice: 732-800-1286 (1BTM)
RSS Feed To My Blog:

Business Process Modeling - BTMSoftwareSolutions.com


From: Ethan Gruber <[hidden email]>
To: [hidden email]
Sent: Wednesday, September 28, 2011 2:42 PM
Subject: [ops-users] Re: Re: Decoding base64Binary

Hi,

Is this typo in the oxf:file-serializer actually in your XPL document:

<p:input nae="data" href="#dynamicFile"/>

I assume it's not because I imagine you might get an error rather than just the base64binary document.

Ethan

On Wed, Sep 28, 2011 at 2:27 PM, bsteuhl <[hidden email]> wrote:
Erik,

I am have a mental block on something.  I am uploading a document and
storing it into MySQL database as base64Binary successfully using
combination of xsl, url, identity and sql processor.  I then want users to
be able to download the document and I need to convert or decode the
base64Binary and I thought this code would work but it just returns the same
base64Binary stored in MySQL:  So I grab the base64Binary data, wrap it in a
document element with appropriate attributes, and then write that file to a
temporary location grabbing the url back in the xForm for user to download.
What part am I missing so that a PDF file stored as base64Binary can be
opened back up as a PDF?

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
       xmlns:sql="http://orbeon.org/oxf/xml/sql"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:oxf="http://www.orbeon.com/oxf/processors"
       xmlns:xi="http://www.w3.org/2001/XInclude"
               xmlns:fe="http://example.com/forms/onViewArrest/xform"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

       <p:param type="input" name="instance"/>
       <p:param type="output" name="data"/>



       <p:processor name="oxf:sql">
               <p:input name="data" href="#instance"/>
               <p:input name="config">
                       <sql:config xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                               <sql:connection>
                                       <sql:datasource>cjpsis</sql:datasource>
                                       <sql:execute>
                                               <sql:query>
                                                       select document from docs where incidentNumber = 'R4';
                                               </sql:query>
                                               <sql:result-set>
                                                       <tempFile>
                                                               <sql:row-iterator>
                                                                       <sql:get-column-value type="xs:base64Binary" column="document"/>
                                                               </sql:row-iterator>
                                                       </tempFile>
                                               </sql:result-set>
                                       </sql:execute>
                               </sql:connection>
                       </sql:config>
               </p:input>
               <p:output name="data" id="file-data"/>
       </p:processor>

       <p:processor name="oxf:xslt">
               <p:input name="data" href="#file-data"/>
               <p:input name="config">
                       <xsl:stylesheet version="2.0">
                               <xsl:template match="/">

                                       <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:base64Binary" content-type="binary/octet-stream">
                                               <xsl:value-of select="."/>
                                       </document>

                               </xsl:template>
                       </xsl:stylesheet>
               </p:input>
               <p:output name="data" id="dynamicFile"/>
       </p:processor>

       <p:processor name="oxf:file-serializer">
               <p:input name="config">
                       <config>
                               <scope>session</scope>
                       </config>
               </p:input>
               <p:input nae="data" href="#dynamicFile"/>
               <p:output name="data" ref="data"/>
       </p:processor>

</p:config>

Brian Steuhl
http://btmsoftwaresolutions.com BTM Software Solutions, LLC

--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Decoding-base64Binary-tp25132p3852365.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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




--
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




--
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: Re: Re: Decoding base64Binary

bsteuhl
I figured out my (couple) of errors.

1. On my submission I now have replace="all"
2. On my page-flow it still remains set at model
3. On my readDoc.xpl after calling database just pass to xsl processor and wrap in document root with appropriate elements prior to sending to http serializer.

Really #1 and 2 were my sticking points and maybe not exactly right or better said maybe a better way to code so if any tips I am always looking to learn.

Hope this thread helped others out there and if similiar questions please do not hesitate in replying or contacting me.

Brian Steuhl
BTM Software Solutions, LLC
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Decoding base64Binary

bsteuhl
Here is screen cast of working code uploading doc to MySQL database from Orbeon xForms and then retrieving Docs from MySQL from same Orbeon xForm.  It took some time but the two submissions and two xpl files with several processors is all it took.

http://www.screencast.com/t/BecgLnpfFC

Brian Steuhl
BTM Software Solutions, LLC
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Decoding base64Binary

Erik Bruchez
Administrator
Brian,

Thanks for sharing!

-Erik

On Wed, Sep 28, 2011 at 8:26 PM, bsteuhl <[hidden email]> wrote:

> Here is screen cast of working code uploading doc to MySQL database from
> Orbeon xForms and then retrieving Docs from MySQL from same Orbeon xForm.
> It took some time but the two submissions and two xpl files with several
> processors is all it took.
>
> http://www.screencast.com/t/BecgLnpfFC
>
> Brian Steuhl
> http://btmsoftwaresolutions.com BTM Software Solutions, LLC
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Decoding-base64Binary-tp25132p3854239.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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
>
>


--
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