Registration of method (web service)
In our example, we need both an IN parameter and a return parameter. The IN parameter is to set a value from the dialogue to the web service while the return parameter is values from the web service. The data we receive from our web service will retrieve customer names that are identified based on an ID.
On the Features tab, click - (+) button to bring up the dialogue. In this dialogue box, the methods used are to be registered. We have to use the example address described initially in the chapter: https://data.brreg.no/enhetsregisteret/api/enheter/.
What needs to be handled in the web service is to retrieve Name of organization based on a unique ID. Each organization has its own business register number.
- Click on the
-sign (+).
- Enter the Name of the method. This is for your own need and does not have any consequences for the web service. Each method is registered with its own name.
- The URL for the method must be added under Url. Remember that the base URL was already registered in the link at an earlier stage, so the part of the URL that must be registered here is the method name. In this case, it is enheter/. Se an example URL in the screenshot above. In addition, we have to add the parameter we need, which is id. Since this is a variable, enter it in a curly bracket: {id}. See xml-example from the web service.
- In Method type, you have the methods: GET, PUT, POST and DELETE. In this example, we need to use the type GET.
In parameter
The first thing to be registered is the IN parameter. In our example, the In parameter must be the id-field. This id must be used as input in the dialogue we are building to retrieve the name of the organization. Click on Add under the In parameter field. A new dialogue box will open where you can edit the parameters. The parameter to be edited is the id.
Give the parameter a Name and select Simple type. You can now select parameter type from the dropdown list. Here you have to select what applies to the parameter in the web service:
- System.String
- System.Int32
- System.Double
- System.Boolean
In our case, we select system.Int32 and click OK.
Read about how to create a custom file, known as «File definition», and how to use it in a web service in the chapter File definition
Return parameter
The return parameter is used if something has to be retrieved from the method in the web service. Click on the Edit-symbol for return parameter and a dialogue box opens.
You choose the Name of it. The name is displayed when you are to use this to build a dialogue at a later stage. We only want this to return one to the dialogue in the form of a name to a text box (for the organization) and we therefore select Simple type of the type System.String. Click OK.
This looks as follows:
Instead of Simple Type, you can choose File definition. The file definition are files you have created under the File definition menu item in the overview page of Interact. The screenshot below contains examples of file definitions that have been created. Select the requested file definition and enter Namespace and click OK.