Test a web service that employs a dynamic array

Now that we have defined all of the fields for our dynamic array, we can test the Web Service and display the SOAP or REST request and response.

About this task

For information on data typing, see D3 processing code mapping to XML datatypes.

Procedure

  1. Right-click the Web Service that hosts your subroutine from the MV Web Service Explorer and select the Test Web Service option.

    The specified Web Service displays in the Editor panel.

  2. Click Refresh .

    The tab is populated with the Service Name, Service Port, any operations or resources defined on the service and the auto-generated Request for the current operation or resource. In addition, since this operation or resource is a cataloged subroutine, the Name, Namespace and Type for the subroutine display in the Operations table.

  3. Select the operation or resource to test from the Operations drop-down.

    The input arguments for the Web Service display in the Operations table.

    Note:
    • If any of the values are simple arguments, select the argument name and enter the value to pass to the SOAP or REST request in the Value column.
    • If any of the values are dynamic array arguments, select the argument name and click Edit to open the Dynamic Array Editor.

    The Dynamic Array Editor displays with a table based on the inventory.request dynamic array definition. In this case, customer.id, item.id, and location.id.

  4. Do the following to edit your dynamic array:
    • For fields defined as Single Types, you can enter your values directly into the table cell.
    • For fields defined as Multi Value or Subvalue Types, click Add, and enter the multivalue and subvalue in the table cell.
    Note: Each subsequent time you click Add, you will need to specify whether you are adding a multivalue or a subvalue from the Select Dynamic Array Element dialog box that displays.

    In our case, we have added 2 item.id multivalues (DVD-200 and DVD-201) and 2 location.id subvalues (IRVINE and SAN JOSE) to the request. Note that in this request, we are asking for:

    • Information on the product DVD-200 and how many units are on hand at the IRVINE location.
    • Information on the product DVD-201 and how many units are on hand at both the IRVINE and SAN JOSE locations.

    The following image illustrates our example. The lower panel displays the resulting XML data that will be included in the Web Service SOAP request.

  5. Click Finish, and then click Execute to run the SOAP or REST request.

    The request is executed and the response displays in a new tab. The following image illustrates the SOAP response for our dynamic array.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/enveloper>
       <soapenv:Body>
          <mvtkws: check-i nv_subResponse
             xmlns:tigws="http://www.rocketsoftware.com/namespaces/ws/mywebservice"
             xmlns:xs="http://www.w3.org/2001/xmLschema"
             xmlns:xsi="http://www.w3.org/2001/xmLschema-instance">
             <inventory.response>
                <customer.id>123</customer.id>
                <items>
                   <item.id>ovo-200</item.id>
                   <description>The office - special edition</description>
                   <list.price>25.99</list.price>
                   <sale.price>19.99></sale.price>
                   <inventory>
                      <location.id>01</location.id>
                      <location.name>Irvine</location.name>
                      <quantity.on.hand>4</quantity.on.hand>
                   </inventory>
                </items>
                <items>
                   <item.id>ovo-201</item.id>
                   <description>The office - season one</description>
                   <list.price>25.99</list.price>
                   <sale.price>19.99</sale.price>
                   <inventory>
                      <location.id>02</location.id>
                      <location.name>San Jose</location.name>
                      <quantity.on.hand>3</quantity.on.hand>
                   </inventory>
                   <inventory>
                      <location.id>01</location.id>
                      <location.name>San Jose</location.name>
                      <quantity.on.hand>5</quantity.on.hand>
                   </inventory>
                </items>
             </inventory.response>
          </mistkws:check-inv_subitesponse>
       </soapenv:Body>
    </soapenv:envelope><

    This SOAP response indicates the following information:

    • The description, list price, sale price, and how many units are on hand at the IRVINE store for the product DVD-200.
    • The description, list price, sale price, and how many units are on hand at both the IRVINE and SAN JOSE stores for the product DVD-201.
    Tip: Click Clear to clear your results.