mardi 3 janvier 2017

Error with Client Web Service Soap

I have my web service which I am sure is good because I have been using almost the same code for another project.

    <?php

    try
    {

        $input=$_POST['txtInput'];
        $wsdl='http://localhost/Search.wsdl';
        $options=array('cache_wsdl'=>WSDL_CACHE_NONE,'features'=>SOAP_SINGLE_ELEMENT_ARRAYS);


        echo "hi1";

        $client=new SoapClient($wsdl,$options);
        echo "hi2";

        $response=$client->viewHealth($input);
        echo "hi3";
        if(isset($response->Health))
        {

            $HTMLDocument="<!Doctype html>
            <html>
             <head>
              <title>Health</title>
              <link rel='stylesheet' type='text/css' href='style.css'/>
             </head>
             <body>

               <table border='2'>
                <thead>
                 <tr id='tabs'>
                  <th>Title</th>
                  <th>Description</th>
                  <th>Symptoms</th>
                  <th>Treatments</th>
                 </tr>
                </thead>
                <tbody>";
                foreach($response->Health as $record)
                {
                    $HTMLDocument.="<tr><td>".$record->Title."</td>";
                    $HTMLDocument.="<td>".$record->Description."</td>";
                    $HTMLDocument.="<td>".$record->Symptoms."</td>";
                    $HTMLDocument.="<td>".$record->Treatments."</td></tr>";
                }
                $HTMLDocument.="</tbody></table></body></html>";
                echo $HTMLDocument;
        }
        else
        { }

}

It is echoing hi1, but not echoing hi2, hi3. I have no idea what is wrong. Can someone please help?




Aucun commentaire:

Enregistrer un commentaire