<?php
// include the SOAP classes
require_once('nusoap.php');


class 
DKFZ_Sweet_soap
{

        function 
DKFZ_Sweet_soap(){;}

        function 
call_Sweet($feld)
        {


        
// define parameter array ()
        
$param = array( "feld" => $feld);

        
// define path to server application
        
$serverpath ='http://www.glycosciences.de/modeling/sweet2/soap/function_soap.php';

        
//define method namespace
        
$namespace="urn:xmethods-BNSweet";

        
// create client object
        
$client = new soapclient($serverpath);

        
// make the call
        
$result $client->call('gen_sweet',$param,$namespace);

        
// if a fault occurred, output error info
        
if (isset($fault)) { print "Error: "$fault; } 

        
// kill object
        
unset($client);

        return 
$result;

    }

        function 
call_Sweet_with_linucs($feld)
        {


                
// define parameter array ()
                
$param = array( "feld" => $feld);

                
// define path to server application
                
$serverpath ='http://www.glycosciences.de/modeling/sweet2/soap/function_soap.php';

                
//define method namespace
                
$namespace="urn:xmethods-BNSweet";

                
// create client object
                
$client = new soapclient($serverpath);

                
// make the call
                
$result $client->call('gen_sweet_with_linucs',$param,$namespace);

                
// if a fault occurred, output error info
                
if (isset($fault)) { print "Error: "$fault; }

                
// kill object
                
unset($client);

                return 
$result;

        }


        function 
call_sweet_example()
        {
                
$feld =  <<<_EOF_
         a-D-Manp-(1-2)-a-D-Manp-(1-6)+
                                      |
                                 a-D-Manp-(1-6)+
                                      |        |
         a-D-Manp-(1-2)-a-D-Manp-(1-3)+   b-D-Manp-(1-4)-b-D-GlcpNAc-(1-4)-b-D-GlcpNAc-(1-4)-Asn
                                               |
   a-D-Manp-(1-2)-a-D-Manp-(1-2)-a-D-Manp-(1-3)+
_EOF_;


                
$example $this->call_Sweet($feld);

                
printf("Calling:\n");
                
printf("$feld\n");

/*
        * ["name"]     = name of the tmp file
                 * ["tmp"]      = the tmp dir
                 *
                 * ["pdb"]      = sweet-pdb output
                 * ["swt"]      = sweet-swt output
                 * ["tnk"]      = sweet-tinker output
                 * ["out"]      = sweet protocoll output
                 * ["err"]      = sweet stderr output (not used)
*/

                
printf("PDB: %s\n",$example["pdb"]);
                
printf("OUT:\n %s\n",$example["out"]);

        
print_r($example);
        }

}


#$sweet = new DKFZ_sweet_soap();

#$sweet->call_sweet_example();






    
?>