Posting to Geoserver

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

Posting to Geoserver

sammeek
Hi Benjamin,

I am trying to post results to geoserver via REST. I have a simple process that returns a GTVectorDataBinding and I'm using the Java client with the following lines:

 executeBuilder.setMimeTypeForOutput("application/WFS", "qual_result");
        executeBuilder.setSchemaForOutput("http://schemas.opengis.net/gml/3.1.0/base/feature.xsd", "qual_result");

The wps_config_geotools.xml has the following lines:

 <Generator name="WFSGenerator" className="org.n52.wps.io.datahandler.generator.GeoserverWFSGenerator" active="true">
        <Format mimetype="application/WFS"/>
        <Property name="Geoserver_host" active="true">localhost</Property>
        <Property name="Geoserver_password" active="true">geoserver</Property>
        <Property name="Geoserver_port" active="true">8010</Property>
        <Property name="Geoserver_username" active="true">admin</Property>
      </Generator>

ProcessDescription has the following:
        <Output>
                        <ows:Identifier>qual_result</ows:Identifier>
                        <ows:Title>result</ows:Title>
                                <ComplexOutput>
                                        <Default>
                                                <Format>
                                                        <MimeType>application/WFS</MimeType>
                                                               
                        </Format>
                </Default>
                <Supported>
                <Format>
                                                        <MimeType>application/WFS</MimeType>
                               
                                                </Format>
                </Supported>
                </ComplexOutput>
        </Output>

I presume that the Geoserver_port is the same as the Tomcat port (I'm running Geoserver on Tomcat). I am also running WPS on the same tomcat, should that cause a problem?

Client error:

Caused by: java.lang.RuntimeException: org.n52.wps.server.ExceptionReport: Could not find an appropriate generator based on given mimetype/schema/encoding for output
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:872)
        at org.n52.wps.server.request.ExecuteRequest.updateStatusSuccess(ExecuteRequest.java:841)
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:694)
        ... 5 more
Caused by: org.n52.wps.server.ExceptionReport: Could not find an appropriate generator based on given mimetype/schema/encoding for output
        at org.n52.wps.server.response.ResponseData.prepareGenerator(ResponseData.java:353)
        at org.n52.wps.server.response.OutputDataItem.updateResponseForInlineComplexData(OutputDataItem.java:104)
        at org.n52.wps.server.response.ExecuteResponseBuilder.generateComplexDataOutput(ExecuteResponseBuilder.java:330)
        at org.n52.wps.server.response.ExecuteResponseBuilder.update(ExecuteResponseBuilder.java:165)
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:858)
        ... 7 more</ows:ExceptionText>

What is the correct MimeType/Schema combination? Any other ideas?

Thanks

Sam


Reply | Threaded
Open this post in threaded view
|

Re: Posting to Geoserver

BenjaminPross
Hi Sam,

Just remove the following line and it should work:

executeBuilder.setSchemaForOutput("http://schemas.opengis.net/gml/3.1.0/base/feature.xsd", "qual_result");

For the Geoserver upload, you just need to specify the mime type. Once uploaded, the result will be available in all formats/schemas the Geoserver supports.

Cheers,

Benjamin
Reply | Threaded
Open this post in threaded view
|

Re: Posting to Geoserver

sammeek
Hi Benjamin,

Thanks for the quick reply. I have done so and I am still getting the following:

2014-10-24 08:26:28,507 [pool-4-thread-5] ERROR org.n52.wps.server.request.ExecuteRequest: Update of process status failed.
org.n52.wps.server.ExceptionReport: Could not find an appropriate generator based on given mimetype/schema/encoding for output
        at org.n52.wps.server.response.ResponseData.prepareGenerator(ResponseData.java:353) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.response.OutputDataItem.updateResponseForInlineComplexData(OutputDataItem.java:104) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.response.ExecuteResponseBuilder.generateComplexDataOutput(ExecuteResponseBuilder.java:330) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.response.ExecuteResponseBuilder.update(ExecuteResponseBuilder.java:165) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:858) [52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.updateStatusSuccess(ExecuteRequest.java:841) [52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:694) [52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92) [52n-wps-server-3.3.0.jar:na]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_11]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_11]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_11]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_11]
2014-10-24 08:26:28,507 [pool-4-thread-5] ERROR org.n52.wps.server.request.ExecuteRequest: Exception/Error while executing ExecuteRequest for storage.geoserver.StoreWFSOutput: java.lang.RuntimeException: org.n52.wps.server.ExceptionReport: Could not find an appropriate generator based on given mimetype/schema/encoding for output
2014-10-24 08:26:28,507 [pool-4-thread-5] INFO  org.n52.wps.commons.context.ExecutionContextFactory: Context unregistered
2014-10-24 08:26:28,507 [http-bio-8010-exec-7] WARN  org.n52.wps.server.handler.RequestHandler: exception while handling ExecuteRequest.
2014-10-24 08:26:28,509 [http-bio-8010-exec-7] ERROR org.n52.wps.server.handler.RequestHandler: exception handling ExecuteRequest.
org.n52.wps.server.ExceptionReport: Error while executing the embedded process for: storage.geoserver.StoreWFSOutput
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:716) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:92) ~[52n-wps-server-3.3.0.jar:na]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_11]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_11]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_11]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_11]
Caused by: java.lang.RuntimeException: org.n52.wps.server.ExceptionReport: Could not find an appropriate generator based on given mimetype/schema/encoding for output
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:872) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.updateStatusSuccess(ExecuteRequest.java:841) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.call(ExecuteRequest.java:694) ~[52n-wps-server-3.3.0.jar:na]
        ... 5 common frames omitted
Caused by: org.n52.wps.server.ExceptionReport: Could not find an appropriate generator based on given mimetype/schema/encoding for output
        at org.n52.wps.server.response.ResponseData.prepareGenerator(ResponseData.java:353) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.response.OutputDataItem.updateResponseForInlineComplexData(OutputDataItem.java:104) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.response.ExecuteResponseBuilder.generateComplexDataOutput(ExecuteResponseBuilder.java:330) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.response.ExecuteResponseBuilder.update(ExecuteResponseBuilder.java:165) ~[52n-wps-server-3.3.0.jar:na]
        at org.n52.wps.server.request.ExecuteRequest.updateStatus(ExecuteRequest.java:858) ~[52n-wps-server-3.3.0.jar:na]
        ... 7 common frames omitted
2014-10-24 08:26:28,509 [http-bio-8010-exec-7] DEBUG org.n52.wps.server.WebProcessingService: org.n52.wps.server.ExceptionReport: Error while executing the embedded process for: storage.geoserver.StoreWFSOutput


It appears that it fails at the generation stage before it even tries to post.

Thanks in advance

Sam
Reply | Threaded
Open this post in threaded view
|

Re: Posting to Geoserver

BenjaminPross
Strange..., is there a chance that you can attach the process here?
Reply | Threaded
Open this post in threaded view
|

Re: Posting to Geoserver

sammeek
Hi Benjamin,

I imagine it's something I am doing. As you can probably guess by the number of posts, I am learning this as I go along!

Client and server code attached.

Thanks

Sam

StoreWFSOutput.javaStoreWFSClient.java

Reply | Threaded
Open this post in threaded view
|

Re: Posting to Geoserver

BenjaminPross
Alright, I need to confirm this, but I think, I found the issue.
In the StoreWFSOutput class, you need to add the output datatype to the qual_result output, i.e., change the following method:

        @Override
        public Class<?> getOutputDataType(String identifier) {
                if(identifier.equalsIgnoreCase("qual_result")){
                       
                }
                return null;
        }

to:

        @Override
        public Class<?> getOutputDataType(String identifier) {
                if(identifier.equalsIgnoreCase("qual_result")){
                        return GTVectorDataBinding.class;
                }
                return null;
        }

Hope this helps.

Cheers,

Benjamin

P.S.: don't worry about the number of your posts :)
Reply | Threaded
Open this post in threaded view
|

Re: Posting to Geoserver

sammeek
Hi Benjamin,

This works well! I have another question but I will start a new thread.

Sam