REST webservice basic

REST webservice basic

The REST webservice basic is a web service that can receive http/https calls using none or basic authentication.

 

For production REST webservice OAuth2.0 is recommended.

 

The parameters of this workflow input type are:

 

NG2RESTWebserviceBasic0001

 

Path

The url this will be called, e.g. invoice will open the address http://localhost:8086/basicws/invoice for listening.

(It will be https, if you have enabled https in InterFormNG2, and the port number 8086 must fit the port number configured for InterFormNG2 (8086 is the default port number).

The address have to be unique for all tenants and workflows.

 

Input type

The input type that will be received, default is XML

 

Username and password

Blank means no authentication, if something is entered, then the user name and password will be checked using basic authentication

 

Receive type

Body only means that the received content is the entire body in the form post, this is the default. The result will be the resulting payload in the workflow (e.g. PDF)

Parameters means Backwards compatible mode, close to InterFormNG, where xml= is the file content and report=true will return a report in XML.

 

Character encoding

If special encodings are used, then this can override the default encoding detecting mecanism. If empty, autodetection is used based on headers.

 

Store request for later forwarding

You need to enable this option, if you intend to use the workflow component, Forward webservice.

 

 

When the workflow is done the current payload of the workflow is returned to the web service caller. This can e.g. be a PDF file, that has been created with the workflow component, Create PDF document or it can e.g. be an XML file which indicates if the workflow was successful or not.

 

Relevant functions are:

 

Set Mime-type

You can use this workflow component to set the mime-type (content type) of the file, that is returned from the workflow.

 

Transformation

If you want to return a transformed XML file, then you should consider to first define a transformation template and then activate it via the workflow component, XSL transformation.

 

If you change the payload you might want to save the initial payload with the component, Payload to named property and later retrieve the original payload again with Named property to payload.

 

 

Simple example for a body post in Java:

String ng2Url="http://localhost:8086/basicws/invoice";

 

URL url = new URL(ng2Url);

 

HttpURLConnection con = (HttpURLConnection)url.openConnection();

con.setRequestMethod("POST");

con.setRequestProperty("Content-Type", "application/xml; UTF-8"); //Content type is important

 

//Uncomment next line to use login

//con.setRequestProperty("Authorization", "Basic "+Base64.getEncoder().encodeToString("login:secret".getBytes()));

 

con.setDoOutput(true);

con.getOutputStream().write("<xml/>".getBytes("UTF-8"));

 

int code = con.getResponseCode();

System.out.println(code);

 

InputStream is=con.getInputStream();

    Notice: Help Center Transition Update

    As of January 13, 2025, we are excited to announce that our new Help Center is in the final stages of development. While the Knowledge Base is already accessible, our current JIRA system will continue to manage support tickets during this transition period. For assistance with InterForm Output Management Software, please refer to the Support for InterForm Output Management Software.

    We appreciate your patience and understanding as we work to enhance your support experience. If you have any questions or encounter any issues, please do not hesitate to reach out via the existing support channels.

    Best regards,
    The InterForm Support Team


      • Related Articles

      • REST webservice basic example

        Below a simple setup is done to illustrate how the REST webservice basic can be setup. The example below can be run without any programming at all. First a simple template to prove, that the workflow has worked and returned a PDF: The template is ...
      • REST webservice OAuth2.0

        The Rest webservice OAuth2.0 is a way to communicate with InterFormNG2, by sending normal http/https requests. The requests are authorized by using OAuth2.0. The REST webservice basic is easier to get started with, but OAuth2.0 is recommended. The ...
      • Forward webservice

        When a workflow has been initiated by a webservice input component, the component Forward webservice can be used to forward the request to another URL. This is currently only implemented together with the input type, REST webservice basic, where the ...
      • Call external HTTP(s) rest apis

        Calling external HTTP(s) rest api's In InterFormNG2 it is possible to call (most) external HTTP REST APIs / Webservices and form submits using workflow components. The calls are based on RFC2616 Hypertext Transfer Protocol HTTP/1.1 ...
      • Workflow input types

        The workflows of InterFormNG2 can get the input from various input types. In the workflow the input type is shown as the leftmost (green) component: The input types are all listed here: AS400 Command input Call InterFormNG2 via a command on the IBM i ...