dragon5006 2011-11-29 12:08
浏览 49

在PHP中建立与WSDL服务的SOAP连接时出错

I am trying to connect a wsdl service. Other methods don't work without login. But when I tried the login I got a httpheaders error. My wsdl link : http://dgpysws.teias.gov.tr/dgpys/services/EVDServis?wsdl

when i look this link= http://dgpysws.teias.gov.tr/dgpys/services/EVDServis.wsdl

<xs:element name="login">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="loginMessage" nillable="true" type="dgp:LoginMessage"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:complexType name="LoginMessage">
<xs:sequence>
<xs:element minOccurs="0" name="Password" nillable="true" type="dgp:StringValue"/>
<xs:element minOccurs="0" name="UserName" nillable="true" type="dgp:StringValue"/>
</xs:sequence>
</xs:complexType>

Here is my php code;

<?php
// Turn up error reporting
ini_set ("display_errors", "1");
error_reporting (E_ALL|E_STRICT);

// Turn off WSDL caching
ini_set ('soap.wsdl_cache_enabled', 0);

$Password = 'deneeme';
$UserName = 'demnenee';

$search_query = new StdClass();
$search_query->oLoginRequest = new StdClass();
$search_query->oLoginRequest->Password = $Password;
$search_query->oLoginRequest->Username = $UserName;

echo "Setting up SOAP options
";

$soap_options = array(
        'trace'       => 1,     // traces let us look at the actual SOAP messages later
        'exceptions'  => 1 );
$wsdl = "http://dgpysws.teias.gov.tr/dgpys/services/EVDServis?wsdl";

echo "Checking SoapClient exists
";
echo '<br>';
if (!class_exists('SoapClient'))
{
        die ("You haven't installed the PHP-Soap module.");
}

echo "Creating webservice connection to $wsdl
";

$webservice = new SoapClient($wsdl,$soap_options);

try {
        $result = $webservice->login($search_query);



        // perform some logic, output the data to Asterisk, or whatever you want to do with it.

} catch (SOAPFault $f) {

        // handle the fault here
        echo 'Hata:' . $f; 

}

echo "Script complete

";
?>

I am getting this error when run php file;

Setting up SOAP options Checking SoapClient exists
Creating webservice connection to http://dgpysws.teias.gov.tr/dgpys/services/EVDServis?wsdl Hata:SoapFault exception: [HTTP] Error Fetching http headers in C:\xampp\htdocs\test\pmum.php:36 Stack trace: #0 [internal function]: SoapClient->__doRequest('__call('login', Array) #2 C:\xampp\htdocs\test\pmum.php(36): SoapClient->login(Object(stdClass)) #3 {main}Script complete

  • 写回答

1条回答 默认 最新

  • dsadsa123111 2013-03-29 15:30
    关注
    $client = new SoapClient("http://dgpysws.teias.gov.tr/dgpys/services/EVDServis.wsdl");
    
    $p1->loginMessage->UserName->v = "Deneme";
    $p1->loginMessage->Password->v = "Deneme";
    
    $deneme = $client->login($p1);
    var_dump($deneme);
    

    worked for me!

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100