Hi Spirifer,
I've tried the method you mentioned like the following:
@DescribeProcess(title = "Test", description = ".")
public class Test implements GeoServerProcess {
@DescribeResult(name = "result", description = "output result")
public String execute(@DescribeParameter(name = "name", description = "name to
return") String name,
ProgressListener listen) throws InterruptedException {
listen.progress(10f);
Thread.sleep(10 * 1000);
listen.progress(30f);
Thread.sleep(10 * 1000);
listen.progress(60f);
Thread.sleep(10 * 1000);
listen.progress(100f);
return "Hello, " + name;
}
}
And when I try to test it using following Post request:
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs"
xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:Test</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>name</ows:Identifier>
<wps:Data>
<wps:LiteralData>koko</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:ResponseDocument storeExecuteResponse="true" status="true">
<wps:Output mimeType="application/json">
<ows:Identifier>result</ows:Identifier>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>
It gives the following response:
<?xml version="1.0" encoding="UTF-8"?>
<wps:ExecuteResponse xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" service="WPS"
serviceInstance="http://localhost:6256/geoserver/ows?"
statusLocation="http://localhost:6256/geoserver/ows?service=WPS&version=1.0.0&request=GetExecutionStatus&executionId=58745f88-16a0-4d4b-ad10-9a5e0f23f172"
version="1.0.0">
<wps:Process wps:processVersion="1.0.0">
<ows:Identifier>
gs:Test
</ows:Identifier>
<ows:Title>
Test
</ows:Title>
<ows:Abstract>
.
</ows:Abstract>
</wps:Process>
<wps:Status creationTime="2018-12-20T12:57:57.257Z">
<wps:ProcessAccepted>
Process accepted.
</wps:ProcessAccepted>
</wps:Status>
</wps:ExecuteResponse>
And when I call the following GET request (to monitor the process progress):
http://localhost:8080/geoserver/ows?service=WPS&version=1.0.0&request=GetExecutionStatus&executionId=58745f88-16a0-4d4b-ad10-9a5e0f23f172
It gives the following response:
<wps:ExecuteResponse xml:lang="en" service="WPS"
serviceInstance="http://localhost:6256/geoserver/ows?"
statusLocation="http://localhost:6256/geoserver/ows?service=WPS&version=1.0.0&request=GetExecutionStatus&executionId=58745f88-16a0-4d4b-ad10-9a5e0f23f172"
version="1.0.0"><wps:Process
wps:processVersion="1.0.0"><ows:Identifier>gs:Test</ows:Identifier><ows:Title>Test</ows:Title><ows:Abstract>.</ows:Abstract></wps:Process><wps:Status
creationTime="2018-12-20T12:57:57.257Z"><wps:ProcessFailed><ows:ExceptionReport
version="1.1.0"><ows:Exception
exceptionCode="NoApplicableCode"><ows:ExceptionText>Process failed during
execution
Parameter arg1 is missing but has min multiplicity >
0</ows:ExceptionText></ows:Exception></ows:ExceptionReport></wps:ProcessFailed></wps:Status></wps:ExecuteResponse>
It tells that there is a missing parameter!!
What is my problem? how should I call this WPS?
Thanks,
Nanaso
Sent with ProtonMail Secure Email.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, December 1, 2018 8:04 PM, Spirifer <[email protected]> wrote:
> Hi,
>
> To have a progress for your process, you need to add a ProgressListener
> parameter in the execute method.
>
> An example:
> @DescribeResult(name = "result", description = "output result")
> public String execute(@DescribeParameter(name = "name", description
> = "name to return") String name,
> ProgressListener listen) throws InterruptedException
> {
>
> listen.progress(10f);
> Thread.sleep(10 * 1000);
> listen.progress(30f);
>
> Thread.sleep(10 * 1000);
> listen.progress(60f);
>
> Thread.sleep(10 * 1000);
> listen.progress(100f);
>
> return "Hello, " + name;
> }
>
> Cheers
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html
>
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to this
> list:
>
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
If you want to request a feature or an improvement, also see this:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users