wps-interface

Interface for generating WPS requests

Usage no npm install needed!

<script type="module">
  import wpsInterface from 'https://cdn.skypack.dev/wps-interface';
</script>

README

wps-interface

This module allows the creation of a WPS Execute request with a simple syntax. As an example, let's create an execute request for a process calculator which will add 2 numbers, a and b and return us an output result.

import { WpsRequest } from "wps-interface";

let request = new WpsRequest()
  .setIdentifier("calculator")
  .generateWpsExecuteRequest(
    [
      {
        id: "a",
        value: "10"
      },
      {
        id: "b",
        value: "20"
      }
    ],
    [{ id: "result" }]
  );

This results in a Javascript Object which can be mapped on an XML document with the x2js library. Conversion can be done like this:

declare var X2JS

const x2js = new X2JS()
x2js.json2xml_str(request)