Hi,

I am trying to send base64 encoded data to a WPS server using GeoTools 
9.3. The input is marked as a ComplexInput by the WPS server, but the 
GeoTools WPS API just ignores the content of the complex input and sends 
an empty input.

The below code is a minimal example that shows the problem. To test is 
just replace the url with the url of any available WPS server.

package doodle;

import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import net.opengis.wps10.DataType;
import net.opengis.wps10.ResponseDocumentType;

import org.eclipse.emf.ecore.EObject;
import org.geotools.data.ows.SimpleHttpClient;
import org.geotools.data.wps.WPSUtils;
import org.geotools.data.wps.WebProcessingService;
import org.geotools.data.wps.request.ExecuteProcessRequest;

public class TestWPSComplexInput {

   public static void main(String[] args) throws Exception {

    URL wpsServerUrl = new URL("http://example.com";);
    String processIdentifier = "dummy";
    SimpleHttpClient hc = new SimpleHttpClient();
    WebProcessingService wps = new WebProcessingService(wpsServerUrl,
                                                        hc,
                                                        null);
    ExecuteProcessRequest execRequest = wps.createExecuteProcessRequest();
    execRequest.setIdentifier(processIdentifier);

    ResponseDocumentType rdt = wps.createResponseDocumentType(false,
                                                              true,
                                                              true,
                                                              "output");
    execRequest.setResponseForm(wps.createResponseForm(rdt, null));

    String inputValue ="some-base-64-data";
    String mime = "application/protobuf";
    int type = WPSUtils.INPUTTYPE_COMPLEXDATA;
    DataType createdInput = WPSUtils.createInputDataType(inputValue,
                                                         type,
                                                         null,
                                                         mime);
    createdInput.getComplexData().setEncoding("base64");

    List<EObject> list = new ArrayList<>();
    list.add(createdInput);
    execRequest.addInput("complexInput1", list);


    wps.issueRequest(execRequest);

   }

}


This code will produce the following XML request to the WPS server. As 
you can see content of the complex input is not included for some 
reason. Does anyone know a fix for this problem?

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute service="WPS" version="1.0.0"
     xmlns:wps="http://www.opengis.net/wps/1.0.0";
     xmlns:ows="http://www.opengis.net/ows/1.1"; 
xmlns:xlink="http://www.w3.org/1999/xlink";>
     <ows:Identifier>dummy</ows:Identifier>
     <wps:DataInputs>
         <wps:Input>
             <ows:Identifier>complexInput1</ows:Identifier>
             <wps:Data>
                 <wps:ComplexData encoding="base64" 
mimeType="application/protobuf"/>
             </wps:Data>
         </wps:Input>
     </wps:DataInputs>
     <wps:ResponseForm>
         <wps:ResponseDocument lineage="false" status="true" 
storeExecuteResponse="true">
             <wps:Output asReference="false">
                 <ows:Identifier>testOutput</ows:Identifier>
             </wps:Output>
         </wps:ResponseDocument>
     </wps:ResponseForm>
</wps:Execute>


Best regards,
Øystein Torget
Senior Engineer
Norwegian Meteorological Institute

PS: Sorry if this becomes a duplicate. I tried to send a message without 
subscribing to the mailing list and it does not seem to have come 
through so I am trying again.

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to