\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{Using SOAP/WSDL to Interface with the Horde API}
Most Horde modules have an API interface which is used by other modules to access and exchange data.  These API's are described in the \textit{modulename/lib/api.php} files.  Calling the \textit{/rpc.php} in your Horde webroot allows you to access the API remotely via XML-RPC/DISCO/SOAP/WSDL/REST etc.   The following script describes how to access a Horde installation remotely and list the APIs that are available.

If you have IMP/Turba installed you can also try these calls which are commented out in the script:

<pre><code class="language-php">
\$test = print\_r(\$client->contacts\_sources(0, true), 1);
\$test = print\_r(\$client->mail\_folderlist(), 1);
</code></pre>
For further information, refer to the <a href="http://dev.horde.org/">http://dev.horde.org/</a>

<pre><code class="language-htmlphp">
<html>
<head><title>Horde WSDL Test</title></head>
<body>
<?php
// By <vijay.mahrra / es.easynet.net>
require\_once 'SOAP/Client.php';
\$horde\_user = @\$\_POST['user'];
\$horde\_pass = @\$\_POST['pass'];
\$horde\_baseurl = @\$\_POST['url'];
?>
<h1>Horde Installation Details</h1>
<form action="<?php echo \$\_SERVER['PHP\_SELF'] ?>" method="POST">
Horde Base Url <input type="text" name="url" type="text" size="80" value="<?php echo \$horde\_baseurl ?>"/> Required<br />
Username <input type="text" name="user" size="20" value="<?php echo \$horde\_user ?>"/><br />
Password <input type="password" name="pass" size="20" value="<?php echo \$horde\_pass ?>"/><br />
<input type="submit"><br />
</form>
<?php
if (!empty(\$horde\_baseurl)) \{
    \$wsdl\_url = \$horde\_baseurl . '/rpc.php?wsdl';
    \$wsdl =\& new SOAP\_WSDL(\$wsdl\_url, array('user' => \$horde\_user, 'pass' => \$horde\_pass));
    if (is\_a(\$wsdl, 'PEAR\_Error')) \{
        echo "<pre>" . print\_r(\$wsdl, 1);
        \$proxy\_code = \$wsdl->getMessage();
    \} else \{
        \$proxy\_code = highlight\_string(\$wsdl->generateProxyCode(), 1);

        \$client = \$wsdl->getProxy();
        if (is\_a(\$client, 'PEAR\_Error')) \{
            \$client = \$client->getMessage();
        \} else \{
            \$client = print\_r(\$client, 1);
        \}
        \$client = new WebService\_hordeService\_hordePort();
        if (!empty(\$horde\_user) \&\& !empty(\$horde\_pass)) \{
            \$test = print\_r(\$client->horde\_listAPIs(), 1);
            //\$test = print\_r(\$client->contacts\_sources(0, true), 1);
            //\$test = print\_r(\$client->mail\_folderlist(), 1);
        \}
    \}

    // write to the html page
    \$content = <<<END
<h1>Horde RPC Test</h1>
<ul>
    <li><a href="\#wsdl">WSDL</a></li>
    <li><a href="\#proxy">Proxy</a></li>
    <li><a href="\#listing">Listing</a></li>
    <li><a href="\#client">Client</a></li>
    <li><a href="\#test">Test</a></li>
</ul>
<hr />
<h2><a name="wsdl">WSDL Document</a> <a class="helplink" href="\$wsdl\_url">\$wsdl\_url</a></h2>
<pre>\$wsdl\_data</pre>
<hr />
<h2><a name="proxy">Proxy Code</a></h2>
\$proxy\_code
<hr />
<h2><a name="test">Test</a></h2>
<pre>\$test</pre>
<hr />
END;
    echo(\$content);
\}
\$listing = highlight\_file(\$\_SERVER["SCRIPT\_FILENAME"], 1);
?>
<h2><a name="listing">Script Code</a></h2>
<?php echo(\$listing); ?>
<hr />
</body>
</html>
</code></pre>
\end{document}
