簡體   English   中英

客戶端Web服務肥皂出錯

[英]Error with Client Web Service Soap

我有我的Web服務,我相信它很好,因為我一直在使用幾乎相同的代碼用於另一個項目。

<?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
    { }

}

它回盪hi1,但不回應hi2,hi3。 我不知道出了什么問題。 有人可以幫忙嗎?

添加一個

catch (Exception $e) {
 echo $e->getMessage();
}

嘗試{}后看看拋出了什么異常。 我會假設wsdl無法訪問。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM