<?php
include("nb_easyxml_lite.php");
include("nb_soapfuncs.php");

/********* Data structures used by this web service *********
*
* type GetHitResult{
*     ['factor']=>{
*     }
*     ['value']=>{
*     }
* }
*
*/

class service
{
    var $Url;

/**
* web service consumer method GetHit
* 
* @param timeout : unsigned
* @return GetHitResult 
*/
    function GetHit($timeout) // returns a GetHitResult
    {
        $soapXML = "<soap:Body>\n";
        $soapXML .= "<GetHit xmlns=\"http://localhost:8080/dart\">\n";
        // Parameter unsigned timeout
        $soapXML .= $this->soapify_unsigned($timeout, "timeout");
        $soapXML .= "</GetHit>\n";
        $soapXML .= "</soap:Body>\n";
        $soapXML = nbSOAP_Envelope($soapXML);
        // Send the request (syncronous http 1.0 only at the moment)
        $soapOut = nbSOAP_request10($this->Url, "http://localhost:8080/dart/GetHit", $soapXML);
    // is it an error?
        $soapStart = strpos($soapOut, "<?xml");
        if($soapStart==-1)
          return false;
        $xml = nb_easyxmldoc(substr($soapOut,$soapStart));
        $body = $xml->findElement("Body", 0, "http://schemas.xmlsoap.org/soap/envelope/");
        $cp = $xml->FindChildElement($body);
        if($cp==false) // empty soap:Body
            return null;
        $tn = $xml->getName($cp);
        if($tn=="Fault") // should really report it...
            return desoap_nbSOAPFault($xml, $cp);
        if($tn != "GetHitResponse")
            return null;
        $cp = $xml->FindChildElement($cp);
        if($cp==false) // empty value
            return null;
        $result = $this->desoap_GetHitResult($xml, $cp, "GetHit");
        return $result;
    }

}
?>