Interface Submission for Data Entry Data

  • Last update:  2023-12-29
  • Overview

    Version

    Report Server Version
    JAR Package VersionPlugin Version

    10.0/11.0

    2018/07/31

    V1.2.0

    Application Scenario

    You may hope that the page/widget events and data entry templates can call the customer system's interface to send data and trigger the process in the customer system after clicking Submit when you fill in reports.

    iconNote:
    The function is not supported on mobile terminals.

    Plugin Introduction

    The plugin can expand custom submission types in Data Entry Attribute, achieving the function of submitting data to the HTTP interface.

    • The main functions of the plugin are as follows.

    • You can set Method/URL and Cell Status on the interface parameter configuration page.

    • You can submit the interface with HTTP GET in a single line and set the parameter value of the URL.

    • You can submit the interface with HTTP POST in a single line and set the form-data, x-www-form-urlencodeed, or json format for the parameter.

    • You can submit the interface with HTTP POST in multiple lines and set the parameter to be in the json format.

    • You can submit the interface with WebService in a single line or multiple lines.

    • You can customize the attributes of the Body and Header parameters, whose values can be set to cells, formulas, and so on.

    • The result returned by interface calling can be saved in the system message. Specified error messages can be sent to the frontend based on the conditions set by results in the JSON format.

    • You can use the data interface submission function for events in a page/widget.

    • Plugin dependencies are provided for the interface authentication of data entry and submission methods. You can customize functions and develop authentication methods like Cookie and Token.

    Plugin Introduction

    Plugin Installation

    You can contact our technical support to obtain the plugin.

    For details about how to install plugins in the designer, see Designer Plugin Management.

    For details about how to install plugins on the server, see Server Plugin Management.

    Operation Method

    You can use the function of interface submission for data entry data after installing the plugin.

    Parameter Submission Configuration

    Data Entry Report

    Open a report, choose Template > Data Entry Attribute, and add a custom submission, as shown in the following figure.

     1.png

    Page/Widget Event

    Choose Template > Web Attribute, click Data Entry Setting, click the + icon in the Event Setting area, add an event, and set Event Type to Submit Data By Interface, as shown in the following figure. Add a widget, add an event, and set Event Type to Submit Data By Interface. To use the function in the page/widget event, you can download the example template GetSubmitEvent.cpt.

     2.png

    The parameter configurations are described as follows.

    • Submission Type Selection: can be set to Submit Data by Interface.

    • Method: can be set to GET/POST/POST JSON/POST Total/SOAP/SOAP Total.

    • Cell Status: allows you to set the triggering condition of the cell value's status. The detailed description of the cell status is as follows.

    1. Modify, Modify/Detele, and Modify/Add: The value of the cell is modified after report initialization.

    2. Add and Modify/Add: Cells are added after report initialization.

    3. Delete and Modify/Delete: The record where a cell is located is deleted.

    4. Default: Cells remain unchanged after report initialization.

    • URL: represents the URL of the interface. / You can embed variable values in the parameter URL. For details, see section "Variables in the Parameter URL."

    • Body Parameter: allows you to set parameter values for the interface in data entry submission and to generate URL parameters with the method set to GET, form parameters or JSON with the method set to POST, and XML files in WebService submission.

    • Header Parameter: allows you to set the Header parameter values for the interface request. For example, you can set the value of Content-Type or values of other headers.

    • Body Content: allows you to set the template for the message body of the interface request, meeting the format requirement of the request content except parameters.

    • Returned Result: allows you to set error conditions for results in the JSON format. When the conditions are met, the frontend window displays the specified error message.

    1. Error identifier: identifies errors in results in the form like code or errorCode.

    2. Success status value: displays the success status value represented by the error code. For example, the value of the error identifier code is 0, which represents no error and successful execution. If the identifier code is not equal to 0, an error message is displayed.

    3. Error message identifier: can be used to extract error messages from results.

    GET

    Set Method/URL to GET. You can download the example template GetSubmitJob.cpt.

     3.png

    POST

    form-data Format

    Set Method/URL to POST. You can download the example template PostSubmitJob.cpt.

     4.png

    x-www-form-urlencoded Format

    Set Method/URL to POST and add the parameter value for Content-Type in Header Parameter. You can download the example template PostSubmitJob-x-www-urlencode.cpt.

     5.png

    POST JSON

    Set Method/URL to POST JSON and add Content-Type (value: application/json) in Header Parameter.

    If the value of Content-Type equals to application/json, the Body parameter is converted to the JSON object format for submission.

    You do not need to enter values in Body Content. You can download the example template PostSubmitJob-json.cpt.

     6.png

    Set Method/URL to POST JSON and add Content-Type (value: application/json) in Header Parameter.

    If the value of Content-Type equals to application/json, the Body parameter is converted to the JSON object format for submission.

    Enter the custom JSON format, which can embed Body parameter variables, in Body Content. You can download the example template PostSubmitJob-json-Custom Format.cpt.

     7.png

    7.1.png

    POST Total

    Set Method/URL to POST Total and add Content-Type (value: application/json) in Header Parameter.

    If the value of Content-Type equals to application/json, the Body parameter with multiple lines is converted to the JSON array format for submission.

    You do not need to enter values in Body Content. You can download the example template PostTotalSubmitJob.cpt.

     8.png

    Set Method/URL to POST Total and add Content-Type (value: application/json) in Header Parameter.

    If the value of Content-Type equals to application/json, the Body parameter with multiple lines is converted to the JSON array format for submission.

    Enter the custom JSON format, which can embed JSON arrays (obtained by calculating the Body parameter with multiple lines) in the format ${paramsData}, in Body Content. You can download the example template PostTotalSubmitJob-Custom Format.cpt.

     9.png

    SOAP

    Set Method/URL to SOAP, set Cell Status and the interface connection URL, and add parameters and corresponding values as needed in Body Parameter. You can download the example template SoapSubmitJob.cpt.

     10.png

    Add Content-Type and set its value to text/xml;charset=UTF-8. Add SOAPAction and set its value to the name of Operation in WebService, as shown in the following figure.

     11.png

    To view the name of Operation in WebService, you can analyze the WSDL address through the software SoapUI, as shown in the following figure.

     12.png

    Enter the needed XML content with the embedded Body parameters in the {Parameter name} format.

     13.png

    SOAP Total

    Set Method/URL to SOAP Total, set Cell Status and the interface connection URL, and add parameters and corresponding values as needed in Body Parameter. You can download the example template SoapSubmitJob-total.cpt.

    Enter the XML content needed by WebService in Body Content. Multiple lines of looping XML nodes, where variables of Body parameters are embedded in the ${Parameter name} format, are enclosed by two delimiters ##LOOP##.

    14.png

    The formatted XML codes are as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:web="webservices.services.weaver.com.cn"
        xmlns:ent="http://entity.srm.ch.com">
        <soapenv:Header/>
        <soapenv:Body>
            <web:createWorkflow>
                <web:in0-array>
                    ##LOOP##
                    <web:in0>
                        <ent:documentCode>${documentCode}</ent:documentCode>
                        <ent:VENDOR_CODE>${VENDOR_CODE}</ent:VENDOR_CODE>
                        <ent:VENDOR_NAME>${VENDOR_NAME}</ent:VENDOR_NAME>
                        <ent:FROM_STAGE>${FROM_STAGE}</ent:FROM_STAGE>
                        <ent:TO_STAGE>${TO_STAGE}</ent:TO_STAGE>
                        <ent:CREATE_DATE>${CREATE_DATE}</ent:CREATE_DATE>
                        <ent:CREATE_BY>${CREATE_BY}</ent:CREATE_BY>
                        <ent:REMARK>${REMARK}</ent:REMARK>
                    </web:in0>
                    ##LOOP##
                </web:in0-array>
            </web:createWorkflow>
        </soapenv:Body>
    </soapenv:Envelope>

    Condition Setting for Reporting Errors of Returned Results

    Set the condition parameter value in Data Entry Attribute, as shown in the figure.

     15.png

    The returned result is as follows:

    {"code": 1, "message": "Running error exception", "status": "error"}

    The result value that meets the condition is displayed in the frontend message box.

     16.png

     

    Variables Used in the Parameter URL

    You can embed variable values in the parameter URL of the template configuration page.

    Take the built-in interface http://localhost:8075/webroot/decision/submitjob/get for testing.

    Define the variable first and concatenate the variable in the URL. You can refer to the example template GetSubmitEvent.cpt.

    You can refer to the error example template GetSubmitJob.cpt.

     17.png

     17.1.png

    Function Extension

    Authentication for the Submission Interface

    Plugin dependencies are provided for the interface authentication of data entry and submission methods. You can customize functions and develop authentication methods like Cookie and Token.

    The plugin provides a development plugin interface for customizing the authentication processing function of submitted requests. You can modify the headers and form parameters of the request to meet the login requirements of third-party URLs.

    The code for the development interface AbstractHttpAuthSubmitJobProcessor is as follows:

    @Openpublic
    class AbstractHttpAuthSubmitJobProcessor implements HttpAuthSubmitJobProcessor {

        public AbstractHttpAuthSubmitJobProcessor() {
        }

        public void processAuth(Map<String, String> params, Map<String, String> headers) {
        }

        public int currentAPILevel() {
            return 1;
        }

        public String mark4Provider() {
            return this.getClass().getName();
        }
    }


    You can call the plugin.xml that depends on the sub-plugin through the following code:

    <dependence>
        <Item type="plugin" key="com.fr.plugin.mqh.submitjob.v10"/>
    </dependence>
    <extra-core>
        <HttpAuthSubmitJobProcessor class="com.fr.plugin.mqh.submitjob.plug.provider.CustomHttpAuthProcessor"/>
    </extra-core>

    The sample code for the custom function is as follows:

    package com.fr.plugin.

    mqh.
    submitjob.plug.provider;
    import com.fr.plugin.

    mqh.submitjob.fun.impl.AbstractHttpAuthSubmitJobProcessor;
    import java.util.
    Map;

    public class 
    CustomHttpAuthProcessor extends AbstractHttpAuthSubmitJobProcessor {

        @Override
        public void processAuth
    (Map<String, String> 
    params, Map<String, String> headers) {
            // TODO For interface authentication and other operations, you can add required parameters to request parameters or request headers.
        }
    }

    You can download the code example of the sub-plugin Child Plugin Code Example.zip.



    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy