@Test
public void testExecuteInputsByRef()
                        throws OWSExceptionReport, IOException, XMLStreamException, URISyntaxException {

    String demoWPSURL = TestProperties.getProperty( "demo_wps_url" );
    Assume.assumeNotNull( demoWPSURL );
    WPSClient wpsClient = new WPSClient( new URL( demoWPSURL ) );
    org.deegree.protocol.wps.client.process.Process proc = wpsClient.getProcess( "ParameterDemoProcess", null );
    ProcessExecution execution = proc.prepareExecution();
    execution.addLiteralInput( "LiteralInput", null, "0", "integer", "seconds" );
    execution.addBBoxInput( "BBOXInput", null, new double[] { 0, 0 }, new double[] { 90, 180 }, "EPSG:4326" );
    // use the process's GetCapabilities document as XML input because we can be sure it's available
    execution.addXMLInput( "XMLInput", null, new URI( demoWPSURL ), true, "text/xml", null, null );
    execution.addBinaryInput( "BinaryInput", null, new URI( REMOTE_BINARY_INPUT ), true, "image/png", null );
    ExecutionOutputs outputs = execution.execute();
    LiteralOutput out1 = (LiteralOutput) outputs.get( 0 );
    Assert.assertEquals( "0", out1.getValue() );
    Assert.assertEquals( "integer", out1.getDataType() );
    Assert.assertEquals( "seconds", out1.getUom() );
    BBoxOutput out2 = (BBoxOutput) outputs.get( 1 );
    Assert.assertTrue( Arrays.equals( new double[] { 0.0, 0.0 }, out2.getLower() ) );
    Assert.assertTrue( Arrays.equals( new double[] { 90.0, 180.0 }, out2.getUpper() ) );
    Assert.assertEquals( "EPSG:4326", out2.getCrs() );
    Assert.assertEquals( 2, out2.getDimension() );
    ComplexOutput output = (ComplexOutput) outputs.get( 2 );
    XMLStreamReader reader = output.getAsXMLStream();
    XMLAdapter searchableXML = new XMLAdapter( reader );
    NamespaceBindings nsContext = new NamespaceBindings();
    nsContext.addNamespace( "wps", WPS_NS );
    nsContext.addNamespace( "ows", OWS_NS );
    XPath xpath = new XPath( "/wps:Capabilities/ows:ServiceIdentification/ows:ServiceType", nsContext );
    String pos = searchableXML.getRequiredNodeAsString( searchableXML.getRootElement(), xpath );
    Assert.assertEquals( pos, "WPS" );
    
    InputStream binaryStream = outputs.getComplex( "BinaryOutput", null ).getAsBinaryStream();
    Assert.assertNotNull( binaryStream );
    binaryStream.close();
    // Assert.assertTrue( compareStreams( new URL( REMOTE_BINARY_INPUT ).openStream(),
    // outputs.getComplex( "BinaryOutput", null ).getAsBinaryStream() ) );
}