2024 Update Rollup 2

Fabasoft app.ducx Code SnippetsPermanent link for this heading

Calling path: http://webserver/fsc/statuscode/200: new window

Example

app.ducx Object Model Language

extend instance FSCOWS@1.1001:WebServiceConfiguration {
  friendlyurlconfig<friendlyurlurl,
                    friendlyurlaction,
                    friendlyurlincont,
                    friendlyurloutcont,
                    friendlyurlparams<friendlyurlparamnr,friendlyurlparamname>,
                    friendlyurlallowedmethods
                    > =
  {
    {
      "statuscode",
      FriendlyStatusCode,
      "",
      "response",
      { {1, "statuscode"} },
      HTTPMETHOD_OPTIONS
    }
  }
}

app.ducx Use Case Language

FriendlyStatusCode(integer statuscode, out string response) {
  variant Object {
    impl = expression {
      coort.Trace("FriendlyStatusCode: outgoing status code", statuscode);
      response = "<text>This is a string Text</text>";

      // The Default Content Type Response in string mode is
      // "text/html; charset=utf-8"

      // Set Content-Type to: "text/xml"

      #TV.FSCASP@1.1001:TV_FRIENDLYURL_FILEEXTENSION = "xml";
      #TV.FSCASP@1.1001:TV_FRIENDLYURL_OUTGOING_STATUSCODE = statuscode;
    }
  }
}

FriendlyStatusCode(integer statuscode, out content response) {
  variant Object {
    impl = expression {
      response = coort.CreateContent();
      response.SetContent(cootx, 1, 65001, "<text>This is a content</text>");

      // There is no default Content-Type when delivering a content
      // -- you have to choose one
      #TV.FSCASP@1.1001:TV_FRIENDLYURL_FILEEXTENSION = "xml";
    }
  }
}

FriendlyStatusCode(integer statuscode, out Content response) {
  variant Object {
    impl = expression {
      content contresponse = coort.CreateContent();
      contresponse.SetContent(cootx, 1, 65001, "<text>This is a Content</text>");
      response.contcontent = contresponse;

      // There is no default Content-Type
      // The Content-Type is set from the Value of the contextension

      response.contextension = "xml";
    }

  }

}