我正在尝试连接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
答案 0 :(得分:1)
$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);
为我工作!