52North / wps-client-lib

WPS client library written in Java. Support for WPS 1.0.0 and 2.0.
Apache License 2.0
6 stars 4 forks source link

Parsing process description fails #8

Closed kr1zz closed 5 years ago

kr1zz commented 5 years ago

When requesting DescribeProcess for process identifier GPODTEST to the ESA's GPOD WPS interface, in WPSClientSession.java, method parseInputStreamToString(InputStream in) catches an exception. It looks like the lib cannot parse the result of the GetDescription (see XML below). I tried following the parse process with the debugger and it fails in class org.n52.geoprocessing.wps.client.decoder.stream.DescribeProcess100ResponseDecoder, in method readLiteralData(StartElement start, XMLEventReader reader, LiteralInputDescription input): when the execution reaches the line <DefaultValue>Test</DefaultValue> of the XML response, the following equals returns false and the execution does not enter the if-body:

} else if (elem.getName().equals(OWS11Constants.Elem.QN_DEFAULT_VALUE)) {
    readDefaultValue(elem, reader, input);
}

but it enters instead the next one:

} else {
    throw unexpectedTag(elem);
}

How can we fix it?

Here's the XML response (pretty printed, but it's taken live from my debugging session):

<wps:ProcessDescriptions service="WPS" version="1.0.0" xml:lang="en-GB" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1">
    <ProcessDescription wps:processVersion="1.0.0" storeSupported="true" statusSupported="true">
        <ows:Identifier>GPODTEST</ows:Identifier>
        <ows:Title>GPODTEST</ows:Title>
        <ows:Abstract>GPODTEST</ows:Abstract>
        <DataInputs>
            <Input minOccurs="1" maxOccurs="65536">
                <ows:Identifier>files</ows:Identifier>
                <ows:Title>Files</ows:Title>
                <ComplexData>
                    <Default>
                        <Format>
                            <MimeType>application/atom+xml</MimeType>
                            <Encoding>utf-8</Encoding>
                        </Format>
                    </Default>
                    <Supported>
                        <Format>
                            <MimeType>application/atom+xml</MimeType>
                            <Encoding>utf-8</Encoding>
                        </Format>
                    </Supported>
                </ComplexData>
            </Input>
            <Input minOccurs="0" maxOccurs="1">
                <ows:Identifier>caption</ows:Identifier>
                <ows:Title>Task Caption</ows:Title>
                <LiteralData>
                    <ows:DataType ows:reference="http://www.w3.org/TR/xmlschema-2/#string">string</ows:DataType>
                    <ows:AnyValue />
                    <DefaultValue>Test</DefaultValue>
                </LiteralData>
            </Input>
        </DataInputs>
        <ProcessOutputs>
            <Output>
                <ows:Identifier>ResultDescription</ows:Identifier>
                <ows:Title>List of output files produced by the process</ows:Title>
                <ComplexOutput>
                    <Default>
                        <Format>
                            <MimeType>application/rdf+xml</MimeType>
                            <Encoding>UTF-8</Encoding>
                        </Format>
                    </Default>
                    <Supported>
                        <Format>
                            <MimeType>application/rdf+xml</MimeType>
                            <Encoding>UTF-8</Encoding>
                        </Format>
                        <Format>
                            <MimeType>application/atom+xml</MimeType>
                            <Encoding>UTF-8</Encoding>
                        </Format>
                        <Format>
                            <MimeType>application/metalink+xml</MimeType>
                            <Encoding>UTF-8</Encoding>
                        </Format>
                    </Supported>
                </ComplexOutput>
            </Output>
        </ProcessOutputs>
    </ProcessDescription>
</wps:ProcessDescriptions>
kr1zz commented 5 years ago

Any news? Anybody could reproduce this?

matthesrieke commented 5 years ago

hi @kr1zz, I created a unit test based on your processdescription. It fails indeed in the parsing of LiteralData. There was a reference to a wrong Element name ("DefaultValue") which threw an exception. After the pull request is merged, it should work as expected!

kr1zz commented 5 years ago

@matthesrieke great! I'll try again ASAP and let you in case of issues. Thank you again.