submission with xml data and file upload ?

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

submission with xml data and file upload ?

Karolin Heiss
Hallo all,

I wonder how to upload files and XML data in one submission?
The XML data and uploaded file has to be validated and saved in one transaction on the server-side.

After submitting my instance data, a servlet reads out the XML data from the request input stream.
<xforms:submission id="submit_1" method="post" ref="instance(employee-instance)" resource="http://localhost:8080/test/submit"/>

To upload files I have to set the submission serialization to multipart/form-data to read out the uploaded temp file.
<xforms:submission id="submit_2" method="post" ref="instance(file-instance)" resource="http://localhost:8080/test/submit" serialization="multipart/form-data"/>

But with multipart/form-data I cant read out the XML data any more because the content of the server is a isMultipartContent of all single form fields.

How can I achieve to send and read out the XML data and file together?


Thank you for your help,
Karolin



--
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: submission with xml data and file upload ?

Alessandro  Vernet
Administrator
Karolin,

The first question is how would you like this to be done at the HTTP  
level? One way is to use a multipart/form-data with 2 parameters: the  
file (as you do now) and the instance. So in XForms, the instance you  
submit would look like:

<instance>
     <file>...</file>
     <employee>...</employee>
</instance>

Inside <employee> you have a serialized version of instance
('employee'). You can populate the value of that element with a  
<xforms:setvalue>, using saxon:serialize(instance('employee', 'xml')),  
that you run just before doing the submission. Could this work for you?

Alex



On Jan 5, 2010, at 5:33 AM, "Karolin Krieg" <[hidden email]>  
wrote:

> Hallo all,
>
> I wonder how to upload files and XML data in one submission?
> The XML data and uploaded file has to be validated and saved in one  
> transaction on the server-side.
>
> After submitting my instance data, a servlet reads out the XML data  
> from the request input stream.
> <xforms:submission id="submit_1" method="post" ref="instance
> (employee-instance)" resource="http://localhost:8080/test/submit"/>
>
> To upload files I have to set the submission serialization to  
> multipart/form-data to read out the uploaded temp file.
> <xforms:submission id="submit_2" method="post" ref="instance(file-
> instance)" resource="http://localhost:8080/test/submit"  
> serialization="multipart/form-data"/>
>
> But with multipart/form-data I cant read out the XML data any more  
> because the content of the server is a isMultipartContent of all  
> single form fields.
>
> How can I achieve to send and read out the XML data and file together?
>
>
> Thank you for your help,
> Karolin
>
>
> --
> 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: submission with xml data and file upload ?

Leigh L. Klotz Jr
In reply to this post by Karolin Heiss
You need submission method="multipart-post" which uses serialization multipart/related.
http://www.w3.org/TR/xforms11/#serialize-multipart
It's not clear that Orbeon implements this currently, though.

Leigh.

On 01/05/2010 05:33 AM, Karolin Krieg wrote:
Hallo all,

I wonder how to upload files and XML data in one submission?
The XML data and uploaded file has to be validated and saved in one transaction on the server-side.

After submitting my instance data, a servlet reads out the XML data from the request input stream.
<xforms:submission id="submit_1" method="post" ref="instance(employee-instance)" resource="http://localhost:8080/test/submit"/>

To upload files I have to set the submission serialization to multipart/form-data to read out the uploaded temp file.
<xforms:submission id="submit_2" method="post" ref="instance(file-instance)" resource="http://localhost:8080/test/submit" serialization="multipart/form-data"/>

But with multipart/form-data I cant read out the XML data any more because the content of the server is a isMultipartContent of all single form fields.

How can I achieve to send and read out the XML data and file together?


Thank you for your help,
Karolin




--
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: submission with xml data and file upload ?

Alessandro  Vernet
Administrator
Leigh,

Yes, but unfortunately the multipart/related serialization is not yet implemented.

Alex



On Jan 6, 2010, at 3:10 AM, "Leigh L. Klotz Jr" <[hidden email]> wrote:

You need submission method="multipart-post" which uses serialization multipart/related.
http://www.w3.org/TR/xforms11/#serialize-multipart
It's not clear that Orbeon implements this currently, though.

Leigh.

On 01/05/2010 05:33 AM, Karolin Krieg wrote:
Hallo all,

I wonder how to upload files and XML data in one submission?
The XML data and uploaded file has to be validated and saved in one transaction on the server-side.

After submitting my instance data, a servlet reads out the XML data from the request input stream.
<xforms:submission id="submit_1" method="post" ref="instance(employee-instance)" resource="http://localhost:8080/test/submit"/>

To upload files I have to set the submission serialization to multipart/form-data to read out the uploaded temp file.
<xforms:submission id="submit_2" method="post" ref="instance(file-instance)" resource="http://localhost:8080/test/submit" serialization="multipart/form-data"/>

But with multipart/form-data I cant read out the XML data any more because the content of the server is a isMultipartContent of all single form fields.

How can I achieve to send and read out the XML data and file together?


Thank you for your help,
Karolin



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Antw: Re: submission with xml data and file upload ?

Karolin Heiss
In reply to this post by Alessandro Vernet
Hey Alex

Unfortunaltely its not working. With
serialization="multipart/form-data" I get all input fields of my xform
and not the instance data.

Do you know when the serialization type multipart/related will be
implemented?

Thank you very much for your help,
Karolin
 

>>> Alessandro Vernet <[hidden email]> 1/6/2010 3:25  >>>
Karolin,

The first question is how would you like this to be done at the HTTP  
level? One way is to use a multipart/form-data with 2 parameters: the

file (as you do now) and the instance. So in XForms, the instance you

submit would look like:

<instance>
     <file>...</file>
     <employee>...</employee>
</instance>

Inside <employee> you have a serialized version of instance
('employee'). You can populate the value of that element with a  
<xforms:setvalue>, using saxon:serialize(instance('employee', 'xml')),

that you run just before doing the submission. Could this work for
you?

Alex



On Jan 5, 2010, at 5:33 AM, "Karolin Krieg" <[hidden email]>

wrote:

> Hallo all,
>
> I wonder how to upload files and XML data in one submission?
> The XML data and uploaded file has to be validated and saved in one

> transaction on the server-side.
>
> After submitting my instance data, a servlet reads out the XML data

> from the request input stream.
> <xforms:submission id="submit_1" method="post" ref="instance
> (employee-instance)" resource="http://localhost:8080/test/submit"/>
>
> To upload files I have to set the submission serialization to  
> multipart/form-data to read out the uploaded temp file.
> <xforms:submission id="submit_2" method="post" ref="instance(file-
> instance)" resource="http://localhost:8080/test/submit"  
> serialization="multipart/form-data"/>
>
> But with multipart/form-data I cant read out the XML data any more  
> because the content of the server is a isMultipartContent of all  
> single form fields.
>
> How can I achieve to send and read out the XML data and file
together?

>
>
> Thank you for your help,
> Karolin
>
>
> --
> 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: Antw: Re: submission with xml data and file upload ?

Erik Bruchez-3
Karolin,

We have no ETA yet for implementing multipart/related. Most likely it
will be implemented if we need it badly for a project or if somebody
sponsors the feature.

-Erik

On Thu, Jan 7, 2010 at 8:51 AM, Karolin Krieg <[hidden email]> wrote:

> Hey Alex
>
> Unfortunaltely its not working. With
> serialization="multipart/form-data" I get all input fields of my xform
> and not the instance data.
>
> Do you know when the serialization type multipart/related will be
> implemented?
>
> Thank you very much for your help,
> Karolin
>
>
>>>> Alessandro Vernet <[hidden email]> 1/6/2010 3:25  >>>
> Karolin,
>
> The first question is how would you like this to be done at the HTTP
> level? One way is to use a multipart/form-data with 2 parameters: the
>
> file (as you do now) and the instance. So in XForms, the instance you
>
> submit would look like:
>
> <instance>
>     <file>...</file>
>     <employee>...</employee>
> </instance>
>
> Inside <employee> you have a serialized version of instance
> ('employee'). You can populate the value of that element with a
> <xforms:setvalue>, using saxon:serialize(instance('employee', 'xml')),
>
> that you run just before doing the submission. Could this work for
> you?
>
> Alex
>
>
>
> On Jan 5, 2010, at 5:33 AM, "Karolin Krieg" <[hidden email]>
>
> wrote:
>
>> Hallo all,
>>
>> I wonder how to upload files and XML data in one submission?
>> The XML data and uploaded file has to be validated and saved in one
>
>> transaction on the server-side.
>>
>> After submitting my instance data, a servlet reads out the XML data
>
>> from the request input stream.
>> <xforms:submission id="submit_1" method="post" ref="instance
>> (employee-instance)" resource="http://localhost:8080/test/submit"/>
>>
>> To upload files I have to set the submission serialization to
>> multipart/form-data to read out the uploaded temp file.
>> <xforms:submission id="submit_2" method="post" ref="instance(file-
>> instance)" resource="http://localhost:8080/test/submit"
>> serialization="multipart/form-data"/>
>>
>> But with multipart/form-data I cant read out the XML data any more
>> because the content of the server is a isMultipartContent of all
>> single form fields.
>>
>> How can I achieve to send and read out the XML data and file
> together?
>>
>>
>> Thank you for your help,
>> Karolin
>>
>>
>> --
>> 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