Difference between revisions of "Part 1: Integrating a Web Service"

From AgileApps Support Wiki
(Created page with "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...")
 
Line 3: Line 3:
## Login to AgileApps Cloud as yourself.
## Login to AgileApps Cloud as yourself.
## Navigate to '''Configuration''' > '''Customization''' > '''Developer Resources''' > '''Web Services''' and click '''New Web Service'''.
## Navigate to '''Configuration''' > '''Customization''' > '''Developer Resources''' > '''Web Services''' and click '''New Web Service'''.
## Enter the following URL: http://currencyconverter.kowabunga.net/converter.asmx?WSDL
## Enter the following URL: http://currencyconverter.kowabunga.net/converter.asmx?WSDL<br><br>[[File:Web_Services_SOAP.png|800px]]<br><br>
## Click '''Download'''.
## Click '''Download'''.
## Select Web service operation '''GetConversionRate''' and provide the other values as shown:
## Select Web service operation '''GetConversionRate''' and provide the other values as shown:<br><br>[[File:Web Services_Currency_Conversion.png|800px]]<br><br>
## Click '''Next'''.
## Click '''Next'''.
## Specify how to integrate the required parameters. In this example, allow mapping of each Web service input parameter to parameters with friendly names '''Input Currency''', '''Output Currency''', and '''Rate Date'''. We will use them later for mapping in the '''SouthEast Process Model''':
## Specify how to integrate the required parameters. In this example, allow mapping of each Web service input parameter to parameters with friendly names '''Input Currency''', '''Output Currency''', and '''Rate Date'''. We will use them later for mapping in the '''SouthEast Process Model''':<br><br>[[File:Web_Services_Input_Field_Mapping.png|800px]]<br><br>
## Click '''Next'''.
## 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 '''Currency Rate'''. We will use this later for mapping in the '''SouthEast Process Model''':
## 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 '''Currency Rate'''. We will use this later for mapping in the '''SouthEast Process Model''':<br><br>[[File:Web_Services_Output_Field_Mapping.png|800px]]<br><br>
## Click '''Save'''.
## Click '''Save'''.
# To test the Web service:
# To test the Web service:
Line 15: Line 15:
## Enter values for all three input parameters and click '''Execute'''.
## Enter values for all three input parameters and click '''Execute'''.
##: You can use '''USD''' and '''EUR''' as sample input currencies and the current date as input for Rate Date. All valid currencies can be requested by calling the Web service operation '''GetCurrencies()''' also contained in the same Web service/WSDL.
##: You can use '''USD''' and '''EUR''' as sample input currencies and the current date as input for Rate Date. All valid currencies can be requested by calling the Web service operation '''GetCurrencies()''' also contained in the same Web service/WSDL.
##: '''Rate Date''' must be specified in the format '''YYYY-MM-DD'''.
##: '''Rate Date''' must be specified in the format '''YYYY-MM-DD'''.<br><br>[[File:Test_Service_Currency_Conversion.png|800px]]<br><br>
# To update the '''SouthEast Process model''' to call the '''Currency Conversion''' 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'''.
## Navigate to '''Configuration''' > '''Customization''' > '''Objects''' > '''Orders''' > '''Processes''' > '''SouthEast Order Process Model'''.
Line 21: Line 21:
## Add an '''Execute Web Service''' step to the Process Model, below the Update Pending element.
## 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.
## 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:
## 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:<br><br>[[File:Execute_Web_Service_01.png|800px]]<br><br>
## 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: <code>YEAR(TODAY())+'-'+IF(LEN(MONTH(TODAY()))<2,'0','')+MONTH(TODAY())+'-'+IF(LEN(DAY(TODAY()))<2,'0','')+DAY(TODAY())</code>
## 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: <code>YEAR(TODAY())+'-'+IF(LEN(MONTH(TODAY()))<2,'0','')+MONTH(TODAY())+'-'+IF(LEN(DAY(TODAY()))<2,'0','')+DAY(TODAY())</code>
##: Click '''Insert'''.  
##: Click '''Insert'''.<br><br>[[File:Execute_Web_Service_02.png|800px]]<br><br>
## Map the Web service output parameter '''Currency Rate''' to the Order Object field '''Currency Rate'''.  
## Map the Web service output parameter '''Currency Rate''' to the Order Object field '''Currency Rate'''.<br><br>[[File:Execute_Web_Service_03.png|800px]]<br><br>
## Click '''Save'''.
## Click '''Save'''.
## Update/enhance the connections in the Process Model diagram as shown:
## Update/enhance the connections in the Process Model diagram as shown:<br><br>[[File:Web_Service_Process_Model.png|800px]]<br><br>
## Check the syntax. Then '''Save''' the Process model.  
## Check the syntax. Then '''Save''' the Process model.  
# To test your updated 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'''.
## 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'''.<br><br>[[File:New_Order_Web_Service.png|800px]]<br><br>
## View the Details of the order to see the current Conversion Rate calculated by the Web service:
## View the Details of the order to see the current Conversion Rate calculated by the Web service:<br><br>[[File:New_Order_Currency_Rate_Update.png|800px]]<br><br>
##: '''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.
##: '''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.

Revision as of 07:56, 12 December 2022

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.

  1. To create the Web service:
    1. Login to AgileApps Cloud as yourself.
    2. Navigate to Configuration > Customization > Developer Resources > Web Services and click New Web Service.
    3. Enter the following URL: http://currencyconverter.kowabunga.net/converter.asmx?WSDL

      Web Services SOAP.png

    4. Click Download.
    5. Select Web service operation GetConversionRate and provide the other values as shown:

      Web Services Currency Conversion.png

    6. Click Next.
    7. Specify how to integrate the required parameters. In this example, allow mapping of each Web service input parameter to parameters with friendly names Input Currency, Output Currency, and Rate Date. We will use them later for mapping in the SouthEast Process Model:

      Web Services Input Field Mapping.png

    8. Click Next.
    9. 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 Currency Rate. We will use this later for mapping in the SouthEast Process Model:

      Web Services Output Field Mapping.png

    10. Click Save.
  2. To test the Web service:
    1. Click Test Service.
    2. Enter values for all three input parameters and click Execute.
      You can use USD and EUR as sample input currencies and the current date as input for Rate Date. All valid currencies can be requested by calling the Web service operation GetCurrencies() also contained in the same Web service/WSDL.
      Rate Date must be specified in the format YYYY-MM-DD.

      Test Service Currency Conversion.png

  3. To update the SouthEast Process model to call the Currency Conversion Web Service:
    1. Navigate to Configuration > Customization > Objects > Orders > Processes > SouthEast Order Process Model.
    2. Click on a process step to open the Process Model in the Process Editor.
    3. Add an Execute Web Service step to the Process Model, below the Update Pending element.
    4. Specify Convert Currency as the step name and select the Web service Currency Conversion [1.0] you created above.
    5. 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:

      Execute Web Service 01.png

    6. 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())
      Click Insert.

      Execute Web Service 02.png

    7. Map the Web service output parameter Currency Rate to the Order Object field Currency Rate.

      Execute Web Service 03.png

    8. Click Save.
    9. Update/enhance the connections in the Process Model diagram as shown:

      Web Service Process Model.png

    10. Check the syntax. Then Save the Process model.
  4. To test your updated Process Model:
    1. 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.

      New Order Web Service.png

    2. View the Details of the order to see the current Conversion Rate calculated by the Web service:

      New Order Currency Rate Update.png

      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.