我如何在php下面的soap请求中执行,
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v="http://incometaxindiaefiling.gov.in/ditws/TaxCredMismatch/v_1_0">
<soapenv:Header/>
<soapenv:Body>
<v:getTaxCredMismatchRequest>
<LoginInfo>
<userName>XXXXXXXXXX</userName>
<password>XXXXXXXXXX</password>
</LoginInfo>
<UserInput>
<panNo>XXXXXXXXXX</panNo>
<asseessmentyear>XXXX-XX</asseessmentyear>
</UserInput>
</v:getTaxCredMismatchRequest>
</soapenv:Body>
</soapenv:Envelope>
我尝试了下面的代码,
<?php
$url = "https://incometaxindiaefiling.gov.in/e-FilingWS/ditws/getTaxCredMismatchRequest.wsdl";
try {
$options = array(
'soap_version'=>SOAP_1_1,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
);
$client = new SoapClient($url,$options);
$requestParams = array(
'userName' => 'AJAPA5855E',
'password' => 'pass123',
'panNo' => 'AJAPA5855E',
'asseessmentyear' => '2014-15'
);
$response = $client->__soapCall("getTaxCredMisMatch", array($requestParams));
var_dump($response);
} catch (Exception $e) {
echo $e->getMessage();
}
?>
但是得到了回复
SOAP-ERROR: Encoding: object has no 'LoginInfo' property
我知道,我正在以正确的方式发送参数,我是否知道如何纠正它。
答案 0 :(得分:1)
我从未使用过肥皂客户端,但我希望如此:
<?php
$url = "https://incometaxindiaefiling.gov.in/e-FilingWS/ditws/getTaxCredMismatchRequest.wsdl";
try {
$options = array(
'soap_version'=>SOAP_1_1,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
);
$client = new SoapClient($url,$options);
$requestParams = array(
'LoginInfo' => array (
'userName' => 'AJAPA5855E',
'password' => 'pass123',
),
'UserInput' => array (
'panNo' => 'AJAPA5855E',
'asseessmentyear' => '2014-15'
)
);
$response = $client->__soapCall("getTaxCredMisMatch", array($requestParams));
var_dump($response);
} catch (Exception $e) {
echo $e->getMessage();
}
?>
然而如上所述,这只是一个疯狂的猜测。看一下该扩展的文档肯定是有道理的:http://php.net/manual/en/class.soapclient.php。这样的事情应该在那里解释......
答案 1 :(得分:0)
使用https://incometaxindiaefiling.gov.in/e-FilingWS/ditws/getTaxCredMismatchRequest.wsdl中的WSDL,您可以从wsdltophp.com生成相应的包,以确保如何在PHP中构造您的请求,因为每个元素都是具有setter / getters的PHP对象。它使用本机PHP SoapClient类,因此,如果您熟悉PHP,您可以轻松快速地了解发送这些请求的人