Difference between revisions of "Part 1: Integrating a Web Service"
From AgileApps Support Wiki
Wikieditor (talk | contribs) |
Wikieditor (talk | contribs) |
||
Line 1: | Line 1: | ||
In this part, you preview the Web services integration capability of the webMethods AgileApps Cloud platform. You add a publically available currency conversion Web service to use in your MyOrders application. First, you create a Web service, and then you update the SouthEast Process Model to call the Web service. | In this part, you preview the Web services integration capability of the webMethods AgileApps Cloud platform. You add a publically available currency conversion Web service to use in your MyOrders application. First, you create a Web service, and then you update the SouthEast Process Model to call the Web service. | ||
To create the Web service, you can either use SOAP or REST web services. The following first step explains both ways: | To create the Web service, you can either use SOAP or REST web services. The following first step explains both ways:<br><br> | ||
''' | '''SOAP Web Service''' | ||
# To create web service: | # To create web service: | ||
## Login to AgileApps Cloud as yourself. | ## Login to AgileApps Cloud as yourself. |
Revision as of 08:28, 24 March 2023
In this part, you preview the Web services integration capability of the webMethods AgileApps Cloud platform. You add a publically available currency conversion Web service to use in your MyOrders application. First, you create a Web service, and then you update the SouthEast Process Model to call the Web service.
To create the Web service, you can either use SOAP or REST web services. The following first step explains both ways:
SOAP Web Service
- To create web service:
- Login to AgileApps Cloud as yourself.
- Navigate to Configuration > Customization > Developer Resources > Web Services and click New Web Service. Click SOAP.
- Enter the following URL: http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL
- Click Download.
- Select Web service operation CountryCurrency and provide the other values as shown:
- Click Next.
- Specify how to integrate the required parameters. In this example, allow mapping of each Web service input parameter to parameters with a friendly name like Currency ISO Code. We will use them later for mapping in the SouthEast Process Model:
- Click Next.
- Specify how to integrate the results of the Web Service call. In this example, allow mapping of the one and only Web service output parameter to a parameter with a friendly name of ISO Alpha 3 Code and Currency Name. We will use this later for mapping in the SouthEast Process Model:
- Click Save.
- To test the Web service:
Note: The steps remain the same post Step 1.
REST Web Service
- To create web service:
- Login to AgileApps Cloud as yourself.
- Navigate to Configuration > Customization > Developer Resources > Web Services and click New Web Service. Click REST.
- Enter the following URL: https://api.coindesk.com/v1/bpi/currentprice.json
- Choose HTTP Method as GET and sample data format as JSON.
- Enter the sample response of the REST API in theNormal Response field.
- Click Next.
- Provide the Title and Version values as shown.
- Click Next.
- On the Input Field Mapping page, keep the URL info hardcoded as shown.
- Specify how the required output field parameters should look like. In this example, allow mapping of each Web service output parameter to parameters with friendly names:
- To test the Web service:
- To update the SouthEast Process model to call the Currency Conversion Web Service:
- Navigate to Configuration > Customization > Objects > Orders > Processes > SouthEast Order Process Model.
- Click on a process step to open the Process Model in the Process Editor.
- Add an Execute Web Service step to the Process Model, below the Update Pending element.
- Specify Convert Currency as the step name and select the Web service Currency Conversion [1.0] you created above.
- Map the first Web service input parameter Input Currency to Order Object field Currency. Click + to add another row for the second input parameter. Map the second Web service input parameter Output Currency to Order Object field New Currency as shown:
- Click + again to add another row for the third Web service input parameter Rate Date. It requires the (current) date in the format YYYY-MM-DD. To provide the current date in the desired format regardless of the used date format settings of the user and/or the tenant, map the Web service input parameter Rate Date by using an expression. Select Use Expression in the drop-down of the first column and click into the empty expression field to bring up the Expression panel. Copy and paste or create the following expression:
YEAR(TODAY())+'-'+IF(LEN(MONTH(TODAY()))<2,'0',)+MONTH(TODAY())+'-'+IF(LEN(DAY(TODAY()))<2,'0',)+DAY(TODAY())
- Map the Web service output parameter Currency Rate to the Order Object field Currency Rate.
- Click Save.
- Update/enhance the connections in the Process Model diagram as shown:
- Check the syntax. Then Save the Process model.
- To test your updated Process Model:
- Create a new Order record related to the SouthEast region. Provide valid values for Currency and New Currency. Assign the order to account Fred Supplies and click Save.
- View the Details of the order to see the current Conversion Rate calculated by the Web service:
- Note: There is currently no value in the Number Line Items field. In the next part of this exercise, you learn how to implement a Java API class to provide a value for this field.
- Create a new Order record related to the SouthEast region. Provide valid values for Currency and New Currency. Assign the order to account Fred Supplies and click Save.