WPS
WPS copied to clipboard
Simple string with line returns as ComplexData
There is some strange behaviour when trying to send an execute request with a string payload as ComplexData. The input is defined in an annotated algorithm:
@ComplexDataInput(identifier = "script", title = "a script", abstrakt = "...", binding = PlainStringBinding.class)
public void setScript(String script) {
this.script = script;
}
NOTE: I already had to make a small change to PlainStringBinding
by adjusting the return type of the getPayload()
method to String
.
When I send the following element, then the WPS fails to determine the input format:
<wps:ComplexData encoding="UTF-8" mimeType="text/plain">
myUTF string
with new lines
</wps:ComplexData>
In InputHanlder
the following input reference description is created, and I have not Idea wy the wcpsAll schema is used here! Setting a schema does not make sense for this input as far as I can see.
<ComplexData>
<Default>
<Format>
<MimeType>text/plain</MimeType>
<Schema>http://schemas.opengis.net/wcps/1.0/wcpsAll.xsd</Schema>
</Format>
</Default>
<Supported>
<Format>
<MimeType>text/plain</MimeType>
<Schema>http://schemas.opengis.net/wcps/1.0/wcpsAll.xsd</Schema>
</Format>
</Supported>
</ComplexData>
Anyway, in following the code is not able to determine a suitable parser (see also #138).
When I provide no information at all, then the org.n52.wps.io.datahandler.parser.WCPSQueryParser
is used and the string is correctly parsed an inserted into my algorithm:
<wps:Input>
<ows:Identifier>script</ows:Identifier>
<wps:Data>
<wps:ComplexData>
myString
anotherline
</wps:ComplexData>
</wps:Data>
</wps:Input>
Setting a different mimeType, e.g. <wps:ComplexData encoding="UTF-8" mimeType="text/x-R">>
, does not make a difference.
Should ComplexData not work for plain text strings as well? Ist there an XML schema for this that I don't know about?