Ignore:
Timestamp:
Jul 18, 2011, 1:46:56 PM (13 years ago)
Author:
djay
Message:

Solving bugs #43 and #42

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-api/js/ZOO-api.js

    r189 r274  
    60676067   *          needs to be interpreted.
    60686068   */
    6069   Execute: function(inputs) {
     6069  Execute: function(inputs,outputs) {
    60706070    if (this.identifier == null)
    60716071      return null;
    6072     var body = new XML('<wps:Execute service="WPS" version="1.0.0" xmlns:wps="'+this.namespaces['wps']+'" xmlns:ows="'+this.namespaces['ows']+'" xmlns:xlink="'+this.namespaces['xlink']+'" xmlns:xsi="'+this.namespaces['xsi']+'" xsi:schemaLocation="'+this.schemaLocation+'"><ows:Identifier>'+this.identifier+'</ows:Identifier>'+this.buildDataInputsNode(inputs)+'</wps:Execute>');
     6072    var body = new XML('<wps:Execute service="WPS" version="1.0.0" xmlns:wps="'+this.namespaces['wps']+'" xmlns:ows="'+this.namespaces['ows']+'" xmlns:xlink="'+this.namespaces['xlink']+'" xmlns:xsi="'+this.namespaces['xsi']+'" xsi:schemaLocation="'+this.schemaLocation+'"><ows:Identifier>'+this.identifier+'</ows:Identifier>'+this.buildDataInputsNode(inputs)+this.buildDataOutputsNode(outputs)+'</wps:Execute>');
    60736073    body = body.toXMLString();
    60746074    var response = ZOO.Request.Post(this.url,body,['Content-Type: text/xml; charset=UTF-8']);
    60756075    return response;
    60766076  },
    6077   /**
    6078    * Property: buildInput
    6079    * Object containing methods to build WPS inputs.
    6080    */
    6081   buildInput: {
    6082     /**
    6083      * Method: buildInput.complex
    6084      * Given an E4XElement representing the WPS complex data input.
     6077  buildOutput:{
     6078    /**
     6079     * Method: buildOutput.ResponseDocument
     6080     * Given an E4XElement representing the WPS ResponseDocument output.
    60856081     *
    60866082     * Parameters:
     
    60916087     * {E4XElement} A WPS Input node.
    60926088     */
     6089    'ResponseDocument': function(identifier,obj) {
     6090      var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:ResponseDocument><wps:Output'+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+(obj["asReference"]?' asReference="'+obj["asReference"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:Output></wps:ResponseDocument></wps:ResponseForm>');
     6091      if (obj.encoding)
     6092        output.*::Data.*::ComplexData.@encoding = obj.encoding;
     6093      if (obj.schema)
     6094        output.*::Data.*::ComplexData.@schema = obj.schema;
     6095      output = output.toXMLString();
     6096      return output;
     6097    },
     6098    'RawDataOutput': function(identifier,obj) {
     6099      var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:RawDataOutput><wps:Output '+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:Output></wps:RawDataOutput></wps:ResponseForm>');
     6100      if (obj.encoding)
     6101        output.*::Data.*::ComplexData.@encoding = obj.encoding;
     6102      if (obj.schema)
     6103        output.*::Data.*::ComplexData.@schema = obj.schema;
     6104      output = output.toXMLString();
     6105      return output;
     6106    }
     6107
     6108  },
     6109  /**
     6110   * Property: buildInput
     6111   * Object containing methods to build WPS inputs.
     6112   */
     6113  buildInput: {
     6114    /**
     6115     * Method: buildInput.complex
     6116     * Given an E4XElement representing the WPS complex data input.
     6117     *
     6118     * Parameters:
     6119     * identifier - {String} the input indetifier
     6120     * data - {Object} A WPS complex data input.
     6121     *
     6122     * Returns:
     6123     * {E4XElement} A WPS Input node.
     6124     */
    60936125    'complex': function(identifier,data) {
    60946126      var input = new XML('<wps:Input xmlns:wps="'+this.namespaces['wps']+'"><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier><wps:Data><wps:ComplexData>'+data.value+'</wps:ComplexData></wps:Data></wps:Input>');
    6095       input.*::Data.*::ComplexData.@mimeType = data.mimetype ? data.mimetype : 'text/plain';
     6127      input.*::Data.*::ComplexData.@mimeType = data.mimetype ? data.mimetype : 'application/json';
    60966128      if (data.encoding)
    60976129        input.*::Data.*::ComplexData.@encoding = data.encoding;
     
    61606192    return '<wps:DataInputs xmlns:wps="'+this.namespaces['wps']+'">'+inputsArray.join('\n')+'</wps:DataInputs>';
    61616193  },
     6194
     6195  buildDataOutputsNode:function(outputs){
     6196    var data, builder, outputsArray=[];
     6197    for (var attr in outputs) {
     6198      data = outputs[attr];
     6199      builder = this.buildOutput[data.type];
     6200      /*if (data.mimetype || data.type == 'complex')
     6201        builder = this.buildInput['complex'];
     6202      else if (data.type == 'reference' || data.type == 'url')
     6203        builder = this.buildInput['reference'];
     6204      else
     6205      builder = this.buildInput['literal'];*/
     6206      outputsArray.push(builder.apply(this,[attr,data]));
     6207    }
     6208    return outputsArray.join('\n');
     6209  },
     6210
    61626211  CLASS_NAME: "ZOO.Process"
    61636212});
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png