How to send CSV data as input to WPS4R?

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

How to send CSV data as input to WPS4R?

Carsten.Friedrich

What is the best way so send CSV data as an input parameter to a WPS4R service (inside the execution request rather than as reference)?

 

How do I declare the input variable in the R script? I assume as “text” since “string” does not keep line breaks?

 

How do I set this input value in the client, specifically in 52n-wps-client-lib? The ExecuteRequestBuilder#addComplexData(...) methods seem to require XML? At least if I try to add some CVS String that way I get:  Caused by: org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA

 

Cheers,

Carsten

 

PS: addComplexData(String parameterID, String value, String schema, String encoding, String mimeType, boolean asReference) seems to be identical to the version without “asReference” (i.e. asReference is ignored anyway).

                                      

--

Dr Carsten Friedrich

Research Team leader

CSIRO Computational Informatics

GPO Box 664,Canberra, ACT 2601

Phone: +61 2 6216 7019

Email: [hidden email]

 

 


_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: How to send CSV data as input to WPS4R?

Daniel
Am 03/11/2014 um 05:41 schrieb [hidden email]:
> What is the best way so send CSV data as an input parameter to a WPS4R
> service (inside the execution request rather than as reference)?

> How do I declare the input variable in the R script? I assume as “text”
> since “string” does not keep line breaks?

Good question - I actually do not have examples for text as input, so
thanks for pointing this out.

I guess you could use either string or text for this, the difference
between them so far is for the output. To preserve linebreaks in the
request you either have to add you own seperator character and split the
data within our R code, or use CDATA, which preserves the line breaks.
The latter is demonstrated in the following script and requests:

https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/main/webapp/R/scripts/test_csv.R

https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_complex.xml

https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_literal.xml


You can either use ComplexData with "text" type or LiteralData with
"string" type (then you need to explicitly put in \n).

Which version of the WPS are you using?

Hope this helps,
Daniel


Notice (for me): If you use complex data, then WPS4R will provide the
contents as a file that you can load in R and it requires
encoding/mimetype, if you use literal data then WPS4R will put the
contents into a variable.


> How do I set this input value in the client, specifically in
> 52n-wps-client-lib? The ExecuteRequestBuilder#addComplexData(...)
> methods seem to require XML? At least if I try to add some CVS String
> that way I get: Caused by: _org.apache.xmlbeans.XmlException_: error:
> Unexpected element: CDATA

Hope the other answer helped with this.

/Daniel

>
> PS: addComplexData(String parameterID, String value, String schema,
> String encoding, String mimeType, boolean asReference) seems to be
> identical to the version without “asReference” (i.e. asReference is
> ignored anyway).
>
> --
>
> Dr Carsten Friedrich
>
> Research Team leader
>
> CSIRO Computational Informatics
>
> GPO Box 664,Canberra, ACT 2601
>
> Phone: +61 2 6216 7019
>
> Email: [hidden email] <mailto:[hidden email]>
>
>
>
> _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>


--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: How to send CSV data as input to WPS4R?

Carsten.Friedrich
Hi Daniel,

Thanks for the quick reply. I use version 3.3.1-SNAPSHOT from github. Two more questions :-) :

1) Is there a better way of doing it? I.e. currently this fails if the text in question contains the characters "]]>". This is unlikely, especially in my current case, but still an uncomfortable shortcoming.

2) How do I do this with the 52n-wps-client-lib?

For literal input, the CDATA trick does not work as

        org.n52.wps.client.ExecuteRequestBuilder.addLiteralData(inputName, inputValue);

will transform "<![CDATA[" into "&lt;![CDATA[". It seems to work just replacing newlines with literal "\n" and leaving out the CDATA declaration, but this will fail if any special XML characters or non XML valid characters are in inputValue.

For text input, none of the methods in org.n52.wps.client.ExecuteRequestBuilder seem to let me add non-xml text, or just a CDATA element.

Cheers,
Carsten

--
Dr Carsten Friedrich
Research Team leader
CSIRO Computational Informatics
GPO Box 664,Canberra, ACT 2601
Phone: +61 2 6216 7019
Email: [hidden email]




-----Original Message-----
From: Geoprocessingservices [mailto:[hidden email]] On Behalf Of Daniel Nüst
Sent: Monday, 3 November 2014 23:25
To: [hidden email]
Subject: Re: [52N Geoprocessingservices] How to send CSV data as input to WPS4R?

Am 03/11/2014 um 05:41 schrieb [hidden email]:
> What is the best way so send CSV data as an input parameter to a WPS4R
> service (inside the execution request rather than as reference)?

> How do I declare the input variable in the R script? I assume as “text”
> since “string” does not keep line breaks?

Good question - I actually do not have examples for text as input, so thanks for pointing this out.

I guess you could use either string or text for this, the difference between them so far is for the output. To preserve linebreaks in the request you either have to add you own seperator character and split the data within our R code, or use CDATA, which preserves the line breaks.
The latter is demonstrated in the following script and requests:

https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/main/webapp/R/scripts/test_csv.R

https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_complex.xml

https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_literal.xml


You can either use ComplexData with "text" type or LiteralData with "string" type (then you need to explicitly put in \n).

Which version of the WPS are you using?

Hope this helps,
Daniel


Notice (for me): If you use complex data, then WPS4R will provide the contents as a file that you can load in R and it requires encoding/mimetype, if you use literal data then WPS4R will put the contents into a variable.


> How do I set this input value in the client, specifically in
> 52n-wps-client-lib? The ExecuteRequestBuilder#addComplexData(...)
> methods seem to require XML? At least if I try to add some CVS String
> that way I get: Caused by: _org.apache.xmlbeans.XmlException_: error:
> Unexpected element: CDATA

Hope the other answer helped with this.

/Daniel

>
> PS: addComplexData(String parameterID, String value, String schema,
> String encoding, String mimeType, boolean asReference) seems to be
> identical to the version without “asReference” (i.e. asReference is
> ignored anyway).
>
> --
>
> Dr Carsten Friedrich
>
> Research Team leader
>
> CSIRO Computational Informatics
>
> GPO Box 664,Canberra, ACT 2601
>
> Phone: +61 2 6216 7019
>
> Email: [hidden email] <mailto:[hidden email]>
>
>
>
> _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>


--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk Local Court Muenster HRB 10849 _______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: How to send CSV data as input to WPS4R?

Daniel
Am 04/11/2014 um 23:20 schrieb [hidden email]:
> Thanks for the quick reply. I use version 3.3.1-SNAPSHOT from github. Two more questions :-) :
>
> 1) Is there a better way of doing it? I.e. currently this fails if the text in question contains the characters "]]>". This is unlikely, especially in my current case, but still an uncomfortable shortcoming.

You'll have to escape those characters yourself, there is no way that I
am aware of to get rid of the CDATA. Though this might be a helpful
discussion:
http://stackoverflow.com/questions/223652/is-there-a-way-to-escape-a-cdata-end-token-in-xml

An alternative would be to pass the complex input as reference, if you
can provide it as an online resource.

> 2) How do I do this with the 52n-wps-client-lib?
>
> For literal input, the CDATA trick does not work as
>
> org.n52.wps.client.ExecuteRequestBuilder.addLiteralData(inputName, inputValue);
>
> will transform "<![CDATA[" into "&lt;![CDATA[". It seems to work just replacing newlines with literal "\n" and leaving out the CDATA declaration, but this will fail if any special XML characters or non XML valid characters are in inputValue.
>
> For text input, none of the methods in org.n52.wps.client.ExecuteRequestBuilder seem to let me add non-xml text, or just a CDATA element.

I'll leave this to Benjamin, since I don't know the client lib.
But it seems to me that a feature to add either non-xml text or CDATA
into a complex element on the client side would certainly be useful in
the client lib.

/Daniel


>
> --
> Dr Carsten Friedrich
> Research Team leader
> CSIRO Computational Informatics
> GPO Box 664,Canberra, ACT 2601
> Phone: +61 2 6216 7019
> Email: [hidden email]
>
>
>
>
> -----Original Message-----
> From: Geoprocessingservices [mailto:[hidden email]] On Behalf Of Daniel Nüst
> Sent: Monday, 3 November 2014 23:25
> To: [hidden email]
> Subject: Re: [52N Geoprocessingservices] How to send CSV data as input to WPS4R?
>
> Am 03/11/2014 um 05:41 schrieb [hidden email]:
>> What is the best way so send CSV data as an input parameter to a WPS4R
>> service (inside the execution request rather than as reference)?
>
>> How do I declare the input variable in the R script? I assume as “text”
>> since “string” does not keep line breaks?
>
> Good question - I actually do not have examples for text as input, so thanks for pointing this out.
>
> I guess you could use either string or text for this, the difference between them so far is for the output. To preserve linebreaks in the request you either have to add you own seperator character and split the data within our R code, or use CDATA, which preserves the line breaks.
> The latter is demonstrated in the following script and requests:
>
> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/main/webapp/R/scripts/test_csv.R
>
> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_complex.xml
>
> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876bbddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_literal.xml
>
>
> You can either use ComplexData with "text" type or LiteralData with "string" type (then you need to explicitly put in \n).
>
> Which version of the WPS are you using?
>
> Hope this helps,
> Daniel
>
>
> Notice (for me): If you use complex data, then WPS4R will provide the contents as a file that you can load in R and it requires encoding/mimetype, if you use literal data then WPS4R will put the contents into a variable.
>
>
>> How do I set this input value in the client, specifically in
>> 52n-wps-client-lib? The ExecuteRequestBuilder#addComplexData(...)
>> methods seem to require XML? At least if I try to add some CVS String
>> that way I get: Caused by: _org.apache.xmlbeans.XmlException_: error:
>> Unexpected element: CDATA
>
> Hope the other answer helped with this.
>
> /Daniel
>
>>
>> PS: addComplexData(String parameterID, String value, String schema,
>> String encoding, String mimeType, boolean asReference) seems to be
>> identical to the version without “asReference” (i.e. asReference is
>> ignored anyway).
>>
>> --
>>
>> Dr Carsten Friedrich
>>
>> Research Team leader
>>
>> CSIRO Computational Informatics
>>
>> GPO Box 664,Canberra, ACT 2601
>>
>> Phone: +61 2 6216 7019
>>
>> Email: [hidden email] <mailto:[hidden email]>
>>
>>
>>
>> _______________________________________________
>> Geoprocessingservices mailing list
>> [hidden email]
>> http://list.52north.org/mailman/listinfo/geoprocessingservices
>> http://geoprocessing.forum.52north.org
>> Please respect our mailing list guidelines:
>> http://52north.org/resources/mailing-lists-and-forums/guidelines
>>
>
>
> --
> Daniel Nüst
> 52°North Initiative for Geospatial Open Source Software GmbH Martin-Luther-King-Weg 24
> 48155 Münster, Germany
> E-Mail: [hidden email]
> Fon: +49-(0)-251–396371-36
> Fax: +49-(0)-251–396371-11
>
> http://52north.org/
> Twitter: @FiveTwoN
>
> General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk Local Court Muenster HRB 10849 _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>


--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: How to send CSV data as input to WPS4R?

Carsten.Friedrich
> > 1) Is there a better way of doing it? I.e. currently this fails if the text in question contains the characters "]]>".
>   This is unlikely, especially in my current case, but still an uncomfortable shortcoming.
>
> You'll have to escape those characters yourself, there is no way that I am aware of to get rid of the CDATA.

Technically this would be quite easy, but I feel it would be against the spirit of WPS: Once I require special encoding for my input, the service will no longer be usable by 3rd party WPS clients without adding it as a special case. Also orchestration and chaining would probably break in most cases.
       
In this case I'd probably rather require all string input to be sent as Base64 encoded UTF-8, but even this feels like imposing a big constraint on interoperability.

Cheers,
Carsten

Ps> Feel free to correct me if I got this wrong, I'm rather new to WPS.

--
Dr Carsten Friedrich
Research Team leader
CSIRO Computational Informatics
GPO Box 664,Canberra, ACT 2601
Phone: +61 2 6216 7019
Email: [hidden email]



-----Original Message-----
From: Geoprocessingservices [mailto:[hidden email]] On Behalf Of Daniel Nüst
Sent: Wednesday, 5 November 2014 18:31
To: [hidden email]
Subject: Re: [52N Geoprocessingservices] How to send CSV data as input to WPS4R?

Am 04/11/2014 um 23:20 schrieb [hidden email]:
> Thanks for the quick reply. I use version 3.3.1-SNAPSHOT from github. Two more questions :-) :
>
> 1) Is there a better way of doing it? I.e. currently this fails if the text in question contains the characters "]]>". This is unlikely, especially in my current case, but still an uncomfortable shortcoming.

You'll have to escape those characters yourself, there is no way that I am aware of to get rid of the CDATA. Though this might be a helpful
discussion:
http://stackoverflow.com/questions/223652/is-there-a-way-to-escape-a-cdata-end-token-in-xml

An alternative would be to pass the complex input as reference, if you can provide it as an online resource.

> 2) How do I do this with the 52n-wps-client-lib?
>
> For literal input, the CDATA trick does not work as
>
> org.n52.wps.client.ExecuteRequestBuilder.addLiteralData(inputName,
> inputValue);
>
> will transform "<![CDATA[" into "&lt;![CDATA[". It seems to work just replacing newlines with literal "\n" and leaving out the CDATA declaration, but this will fail if any special XML characters or non XML valid characters are in inputValue.
>
> For text input, none of the methods in org.n52.wps.client.ExecuteRequestBuilder seem to let me add non-xml text, or just a CDATA element.

I'll leave this to Benjamin, since I don't know the client lib.
But it seems to me that a feature to add either non-xml text or CDATA into a complex element on the client side would certainly be useful in the client lib.

/Daniel


>
> --
> Dr Carsten Friedrich
> Research Team leader
> CSIRO Computational Informatics
> GPO Box 664,Canberra, ACT 2601
> Phone: +61 2 6216 7019
> Email: [hidden email]
>
>
>
>
> -----Original Message-----
> From: Geoprocessingservices
> [mailto:[hidden email]] On Behalf Of Daniel
> Nüst
> Sent: Monday, 3 November 2014 23:25
> To: [hidden email]
> Subject: Re: [52N Geoprocessingservices] How to send CSV data as input to WPS4R?
>
> Am 03/11/2014 um 05:41 schrieb [hidden email]:
>> What is the best way so send CSV data as an input parameter to a
>> WPS4R service (inside the execution request rather than as reference)?
>
>> How do I declare the input variable in the R script? I assume as “text”
>> since “string” does not keep line breaks?
>
> Good question - I actually do not have examples for text as input, so thanks for pointing this out.
>
> I guess you could use either string or text for this, the difference between them so far is for the output. To preserve linebreaks in the request you either have to add you own seperator character and split the data within our R code, or use CDATA, which preserves the line breaks.
> The latter is demonstrated in the following script and requests:
>
> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876b
> bddd/52n-wps-webapp/src/main/webapp/R/scripts/test_csv.R
>
> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876b
> bddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_complex.x
> ml
>
> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876b
> bddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_literal.x
> ml
>
>
> You can either use ComplexData with "text" type or LiteralData with "string" type (then you need to explicitly put in \n).
>
> Which version of the WPS are you using?
>
> Hope this helps,
> Daniel
>
>
> Notice (for me): If you use complex data, then WPS4R will provide the contents as a file that you can load in R and it requires encoding/mimetype, if you use literal data then WPS4R will put the contents into a variable.
>
>
>> How do I set this input value in the client, specifically in
>> 52n-wps-client-lib? The ExecuteRequestBuilder#addComplexData(...)
>> methods seem to require XML? At least if I try to add some CVS String
>> that way I get: Caused by: _org.apache.xmlbeans.XmlException_: error:
>> Unexpected element: CDATA
>
> Hope the other answer helped with this.
>
> /Daniel
>
>>
>> PS: addComplexData(String parameterID, String value, String schema,
>> String encoding, String mimeType, boolean asReference) seems to be
>> identical to the version without “asReference” (i.e. asReference is
>> ignored anyway).
>>
>> --
>>
>> Dr Carsten Friedrich
>>
>> Research Team leader
>>
>> CSIRO Computational Informatics
>>
>> GPO Box 664,Canberra, ACT 2601
>>
>> Phone: +61 2 6216 7019
>>
>> Email: [hidden email] <mailto:[hidden email]>
>>
>>
>>
>> _______________________________________________
>> Geoprocessingservices mailing list
>> [hidden email]
>> http://list.52north.org/mailman/listinfo/geoprocessingservices
>> http://geoprocessing.forum.52north.org
>> Please respect our mailing list guidelines:
>> http://52north.org/resources/mailing-lists-and-forums/guidelines
>>
>
>
> --
> Daniel Nüst
> 52°North Initiative for Geospatial Open Source Software GmbH
> Martin-Luther-King-Weg 24
> 48155 Münster, Germany
> E-Mail: [hidden email]
> Fon: +49-(0)-251–396371-36
> Fax: +49-(0)-251–396371-11
>
> http://52north.org/
> Twitter: @FiveTwoN
>
> General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk Local Court
> Muenster HRB 10849 _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>


--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk Local Court Muenster HRB 10849 _______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: How to send CSV data as input to WPS4R?

BenjaminPross
This was discussed earlier in this post: Issues-with-using-text-plain-as-an-input. We could provide you with a patched ExecuteRequestBuilder class, if applicable. Just let us know.

Cheers,

Benjamin
Reply | Threaded
Open this post in threaded view
|

Re: How to send CSV data as input to WPS4R?

Daniel
In reply to this post by Carsten.Friedrich
Am 05/11/2014 um 22:40 schrieb [hidden email]:
>>> 1) Is there a better way of doing it? I.e. currently this fails if the text in question contains the characters "]]>".
>>    This is unlikely, especially in my current case, but still an uncomfortable shortcoming.
>>
>> You'll have to escape those characters yourself, there is no way that I am aware of to get rid of the CDATA.
>
> Technically this would be quite easy, but I feel it would be against the spirit of WPS: Once I require special encoding for my input, the service will no longer be usable by 3rd party WPS clients without adding it as a special case. Also orchestration and chaining would probably break in most cases.

How would exactly would you do this? By having your own escape /
replacement characters?

If we find a way to reasonably communicate your special encoding to the
user then you'll still be interoperable.

/Daniel

> In this case I'd probably rather require all string input to be sent as Base64 encoded UTF-8, but even this feels like imposing a big constraint on interoperability.
>
> Cheers,
> Carsten
>
> Ps> Feel free to correct me if I got this wrong, I'm rather new to WPS.
>
> --
> Dr Carsten Friedrich
> Research Team leader
> CSIRO Computational Informatics
> GPO Box 664,Canberra, ACT 2601
> Phone: +61 2 6216 7019
> Email: [hidden email]
>
>
>
> -----Original Message-----
> From: Geoprocessingservices [mailto:[hidden email]] On Behalf Of Daniel Nüst
> Sent: Wednesday, 5 November 2014 18:31
> To: [hidden email]
> Subject: Re: [52N Geoprocessingservices] How to send CSV data as input to WPS4R?
>
> Am 04/11/2014 um 23:20 schrieb [hidden email]:
>> Thanks for the quick reply. I use version 3.3.1-SNAPSHOT from github. Two more questions :-) :
>>
>> 1) Is there a better way of doing it? I.e. currently this fails if the text in question contains the characters "]]>". This is unlikely, especially in my current case, but still an uncomfortable shortcoming.
>
> You'll have to escape those characters yourself, there is no way that I am aware of to get rid of the CDATA. Though this might be a helpful
> discussion:
> http://stackoverflow.com/questions/223652/is-there-a-way-to-escape-a-cdata-end-token-in-xml
>
> An alternative would be to pass the complex input as reference, if you can provide it as an online resource.
>
>> 2) How do I do this with the 52n-wps-client-lib?
>>
>> For literal input, the CDATA trick does not work as
>>
>> org.n52.wps.client.ExecuteRequestBuilder.addLiteralData(inputName,
>> inputValue);
>>
>> will transform "<![CDATA[" into "&lt;![CDATA[". It seems to work just replacing newlines with literal "\n" and leaving out the CDATA declaration, but this will fail if any special XML characters or non XML valid characters are in inputValue.
>>
>> For text input, none of the methods in org.n52.wps.client.ExecuteRequestBuilder seem to let me add non-xml text, or just a CDATA element.
>
> I'll leave this to Benjamin, since I don't know the client lib.
> But it seems to me that a feature to add either non-xml text or CDATA into a complex element on the client side would certainly be useful in the client lib.
>
> /Daniel
>
>
>>
>> --
>> Dr Carsten Friedrich
>> Research Team leader
>> CSIRO Computational Informatics
>> GPO Box 664,Canberra, ACT 2601
>> Phone: +61 2 6216 7019
>> Email: [hidden email]
>>
>>
>>
>>
>> -----Original Message-----
>> From: Geoprocessingservices
>> [mailto:[hidden email]] On Behalf Of Daniel
>> Nüst
>> Sent: Monday, 3 November 2014 23:25
>> To: [hidden email]
>> Subject: Re: [52N Geoprocessingservices] How to send CSV data as input to WPS4R?
>>
>> Am 03/11/2014 um 05:41 schrieb [hidden email]:
>>> What is the best way so send CSV data as an input parameter to a
>>> WPS4R service (inside the execution request rather than as reference)?
>>
>>> How do I declare the input variable in the R script? I assume as “text”
>>> since “string” does not keep line breaks?
>>
>> Good question - I actually do not have examples for text as input, so thanks for pointing this out.
>>
>> I guess you could use either string or text for this, the difference between them so far is for the output. To preserve linebreaks in the request you either have to add you own seperator character and split the data within our R code, or use CDATA, which preserves the line breaks.
>> The latter is demonstrated in the following script and requests:
>>
>> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876b
>> bddd/52n-wps-webapp/src/main/webapp/R/scripts/test_csv.R
>>
>> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876b
>> bddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_complex.x
>> ml
>>
>> https://github.com/nuest/WPS/blob/215060685763699a9c5cd6b154f90182876b
>> bddd/52n-wps-webapp/src/test/resources/R/ExecuteTestCSVInput_literal.x
>> ml
>>
>>
>> You can either use ComplexData with "text" type or LiteralData with "string" type (then you need to explicitly put in \n).
>>
>> Which version of the WPS are you using?
>>
>> Hope this helps,
>> Daniel
>>
>>
>> Notice (for me): If you use complex data, then WPS4R will provide the contents as a file that you can load in R and it requires encoding/mimetype, if you use literal data then WPS4R will put the contents into a variable.
>>
>>
>>> How do I set this input value in the client, specifically in
>>> 52n-wps-client-lib? The ExecuteRequestBuilder#addComplexData(...)
>>> methods seem to require XML? At least if I try to add some CVS String
>>> that way I get: Caused by: _org.apache.xmlbeans.XmlException_: error:
>>> Unexpected element: CDATA
>>
>> Hope the other answer helped with this.
>>
>> /Daniel
>>
>>>
>>> PS: addComplexData(String parameterID, String value, String schema,
>>> String encoding, String mimeType, boolean asReference) seems to be
>>> identical to the version without “asReference” (i.e. asReference is
>>> ignored anyway).
>>>
>>> --
>>>
>>> Dr Carsten Friedrich
>>>
>>> Research Team leader
>>>
>>> CSIRO Computational Informatics
>>>
>>> GPO Box 664,Canberra, ACT 2601
>>>
>>> Phone: +61 2 6216 7019
>>>
>>> Email: [hidden email] <mailto:[hidden email]>
>>>
>>>
>>>
>>> _______________________________________________
>>> Geoprocessingservices mailing list
>>> [hidden email]
>>> http://list.52north.org/mailman/listinfo/geoprocessingservices
>>> http://geoprocessing.forum.52north.org
>>> Please respect our mailing list guidelines:
>>> http://52north.org/resources/mailing-lists-and-forums/guidelines
>>>
>>
>>
>> --
>> Daniel Nüst
>> 52°North Initiative for Geospatial Open Source Software GmbH
>> Martin-Luther-King-Weg 24
>> 48155 Münster, Germany
>> E-Mail: [hidden email]
>> Fon: +49-(0)-251–396371-36
>> Fax: +49-(0)-251–396371-11
>>
>> http://52north.org/
>> Twitter: @FiveTwoN
>>
>> General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk Local Court
>> Muenster HRB 10849 _______________________________________________
>> Geoprocessingservices mailing list
>> [hidden email]
>> http://list.52north.org/mailman/listinfo/geoprocessingservices
>> http://geoprocessing.forum.52north.org
>> Please respect our mailing list guidelines:
>> http://52north.org/resources/mailing-lists-and-forums/guidelines
>>
>
>
> --
> Daniel Nüst
> 52°North Initiative for Geospatial Open Source Software GmbH Martin-Luther-King-Weg 24
> 48155 Münster, Germany
> E-Mail: [hidden email]
> Fon: +49-(0)-251–396371-36
> Fax: +49-(0)-251–396371-11
>
> http://52north.org/
> Twitter: @FiveTwoN
>
> General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk Local Court Muenster HRB 10849 _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>


--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines