繁体   English   中英

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

[英]Error establishing a SOAP connection to a WSDL service in PHP

我正在尝试连接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文件时出现此错误;

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

$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);

为我工作!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM