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

发布于 2024-12-18 08:30:08 字数 2628 浏览 0 评论 0原文

我正在尝试连接 wsdl 服务。其他方法在没有登录的情况下不起作用。但是当我尝试登录时,出现 httpheaders 错误。我的 wsdl 链接: http://dgpysws.teias.gov.tr/dgpys/services /EVDServis?wsdl

当我查看此链接= 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>

这是我的 php 代码;

<?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\n";

$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\n";
echo '<br>';
if (!class_exists('SoapClient'))
{
        die ("You haven't installed the PHP-Soap module.");
}

echo "Creating webservice connection to $wsdl\n";

$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\n\n";
?>

运行 php 文件时出现此错误;

设置 SOAP 选项检查 SoapClient 是否存在
创建与 http://dgpysws.teias.gov.tr/dgpys/services/EVDServis?wsdl Hata:SoapFault 异常的 Web 服务连接:[HTTP] 在 C:\xampp\htdocs\test\pmum 中获取 http 标头时出错。 php:36 堆栈跟踪: #0 [内部函数]: SoapClient->__doRequest('__call('login', Array) #2 C:\xampp\htdocs\test\pmum.php(36): SoapClient->login(Object(stdClass)) #3 {main}脚本完成

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\n";

$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\n";
echo '<br>';
if (!class_exists('SoapClient'))
{
        die ("You haven't installed the PHP-Soap module.");
}

echo "Creating webservice connection to $wsdl\n";

$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\n\n";
?>

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

じ违心 2024-12-25 08:30:08
$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);

为我工作!

$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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文