In the following example, the Data Connector applet connects to the web service at http://example.com/WebServiceExample/. The Web Service interface definition consists of two parts: Request and Response.

Request

The first element in the request object is Url. The Data Connector applet identifies the web service to connect to in the Url element. The method the Data Connector applet uses to connect to the web service is a POST method.

The Data Connector applet sends two headers:

The Data Connector applet sends a value in the orderId element within the Body element. The Data Connector obtains the order ID value from an IVR slot, IVRSlot|OrderId. The caller provided the order ID to an IVR applet earlier in the call.

Response

The Type element in the response identifies the language of the response. In this example, the response is in XML.

The ResponseCodeDestination defines the Data Source that the Data Connector applet must store the response code in. The response code is a standard HTTP response code.

The Data Connector applet locates and stores two values from the web service response object:

<ApiInteraction>
  <Request>
    <Url>http://example.com/WebServiceExample/</Url>
    <Method>POST</Method>
    <Headers>
      <Header>
        <Key>Content-Type</Key>
        <Value>application/xml</Value>
      </Header>
      <Header>
        <Key>Password</Key>
        <Value>#(WebServicePassword)</Value>
      </Header>
    </Headers>
    <Body><![CDATA[<?xml version='1.0' encoding='utf-8' ?><orderId>$(IVRSlot|OrderID)</orderId>]]></Body>
  </Request>
  <Response>
    <Type>XML</Type>
    <ResponseCodeDestination>WebService|HttpResponseCode</ResponseCodeDestination>
    <Fields>
      <Field>
        <Locator>/name</Locator>
        <Destination>ExampleCo|CustomerName</Destination>
        <DataType>String</DataType>
      </Field>
      <Field>
        <Locator>/despatch</Locator>
        <Destination>ExampleCo|DespatchDate</Destination>
        <DataType>String</DataType>
      </Field>
    </Fields>
  </Response>
</ApiInteraction>