We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

How to call SOAP API using VXML?

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

How to call SOAP API using VXML?

Post by vikas »

Hi Plum

I have a requirement where I need to call a SOAP API and fetch few response fields.

Going through other Posts I see that Plum recommends to use <data> tag.
But how do we send request parameters & set request header for SOAP API call.

Is there any example implementation that I can refer to?

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: How to call SOAP API using VXML?

Post by support »

Hi Vikas,

Headers are supported but there is no SOAP method in vxml.

Regards,
Plum Support

vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

Re: How to call SOAP API using VXML?

Post by vikas »

Do you mean that I cannot call SOAP API using <data> tag?
If not what are my options? Let me know. Thanks.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: How to call SOAP API using VXML?

Post by support »

Hi Vikas,

That is correct. It is not possible to use a SOAP API using the <data> tag.

We recommend that you use some web scripting language to connect to your SOAP API and generate a valid VXML response based on the result. Here is an simple example in PHP:

start.vxml:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <var name="account_number"/>
  <form>
    <field name="account" type="digits">
      <prompt>
        Please enter your account number.
      </prompt>
      <filled>
        <assign name="account_number" expr="account"/>
        <submit next="webservice.php" method="post" namelist="account_number" />
      </filled>
    </field>
  </form>
</vxml>
webservice.php:

Code: Select all

<?php
  header("Content-type: text/xml");
  echo("<?xml version=\"1.0\"?>\n");
  // get the variables posted to this script
  $account_number = $_POST['account_number'];

  // connect to SOAP webservice
  $soap_url = "http://someurl.to/your/wsdl";
  $client = new SoapClient($soap_url);

  $params = array(
    'AccountNum' => $account_number
  );

  $response = $client->validate($params);  //TRUE or FALSE
?>

<vxml version="2.0">
  <form>
    <block>
      <prompt>
<? if ($response): ?>
        Your account is valid.
<? else: ?>
        Your accound is invalid.
<? endif; ?>
      </prompt>
      <exit/>
    </block>
  </form>
</vxml>
Regards,
Plum Support

Post Reply