【问题标题】:Error with Client Web Service Soap客户端 Web 服务肥皂错误
【发布时间】:2017-01-03 18:53:15
【问题描述】:

我有我的网络服务,我确信它很好,因为我在另一个项目中使用了几乎相同的代码。

<?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。我不知道出了什么问题。有人可以帮忙吗?

【问题讨论】:

    标签: php web soap service wsdl


    【解决方案1】:

    添加一个

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

    在您尝试{}后查看抛出了什么异常。我会假设 wsdl 无法访问。

    【讨论】:

    • 我已经放了一个。但是正在显示一个空白页面。
    • 我收到内部服务器错误异常
    • 我尝试过调试,但现在出现异常:看起来我们没有 XML 文档
    猜你喜欢
    • 1970-01-01
    • 2019-01-27
    • 2021-10-17
    • 2021-11-16
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多