我现在有一个多星期没有找到解决方案了。我试图进行SOAP调用,其中所需的请求结构是
<xs:element name="getMismatchRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="LoginInfo" type="LoginInfoType"/>
<xs:element name="UserInput" type="UserInputType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="LoginInfoType">
<xs:sequence>
<xs:element name="userName" nillable="true" type="xs:string"/>
<xs:element name="password" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UserInputType">
<xs:sequence>
<xs:element name="panNo" nillable="true" type="xs:string"/>
<xs:element name="asseessmentyear" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
我尝试了各种方法,使用SoapClient&amp; nusoap也是,发送&#39; getMismatchRequest&#39;但它没有奏效。
对我来说没有任何效果。
这是我使用SoapClient的代码,我使用的凭据是工作凭据。
$requestParams3 = array(
'LoginInfo' => array(
'userName' => 'XXXX',
'password' => 'XXXX'
),
'addClient' => array(
'addClientDetails' => array(
'panNumber' => 'XXXX2323X',
'dateOfBirth' => '1983-12-01',
'email' => 'email@example.com'
)
)
);
try {
$client = new SoapClient($wsdl, array(
'cache_wsdl' => 0,
"trace" => true,
"exceptions" => false,
"soap_version" => "SOAP_1_1"
));
$response = $client->addClientDetails($requestParams3);
print($client->__getLastRequestHeaders());
print($client->__getLastResponseHeaders());
} catch (Exception $e) {
print(json_encode($e));
}
print_r(json_encode($response));
我需要帮助才能找到提出此请求的正确方法。我的感觉是我在构造复杂类型请求参数时犯了一些错误。
修改 很抱歉错过了重要部分。
我收到此错误:
{"faultstring":"Authentication failed. Please provide a valid User ID and Password","faultcode":"ns0:Client"}
更多信息:
我也尝试过使用nusoap.php
这是代码:
require_once('build/nusoap/lib/nusoap.php');
$client = new nusoap_client($wsdl, true);
$error = $client->getError();
if ($error) {
echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}
$result = "";
$requestParams3 = array('getTaxCredMismatchRequest' => array(
'LoginInfo' => array(
'userName' => 'XXXX',
'password' => 'XXXX'
),
'UserInput' => array(
'panNo' => 'AGOPN8324J',
'asseessmentyear' => '2014-15'
))
);
if ($client) {
$client->soap_defencoding = 'UTF-8';
$result = $client->call("getTaxCredMisMatch", $requestParams3);
}
if ($client->fault) {
echo "<h2>Fault</h2><pre>";
print_r($result);
echo "</pre>";
} else {
$error = $client->getError();
if ($error) {
echo "<h2>Error</h2><pre>" . $error . "</pre>";
} else {
echo "<h2>zip code</h2><pre>";
echo $result;
echo "</pre>";
}
}
echo "<h2>Request</h2>";
echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
echo "<h2>Response</h2>";
echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
错误:
Fault
Array
(
[faultcode] => ns0:Client
[faultstring] => Array
(
[!xml:lang] => en
[!] => Authentication failed. Please provide a valid User ID and Password
)
)
Request
POST /e-FilingWS/ditws HTTP/1.0
Host: incometaxindiaefiling.gov.in
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
Content-Length: 719
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns9146="http://tempuri.org"><SOAP-ENV:Body><getTaxCredMismatchRequest xmlns="http://incometaxindiaefiling.gov.in/ditws/TaxCredMismatch/v_1_0"><LoginInfo xmlns=""><userName xmlns="">XXXX</userName><password xmlns="">XXXX</password></LoginInfo><UserInput xmlns=""><panNo xmlns="">AGOPN8324J</panNo><asseessmentyear xmlns="">2014-15</asseessmentyear></UserInput></getTaxCredMismatchRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response
HTTP/1.1 500 Internal Server Error
Date: Sun, 02 Aug 2015 01:47:15 GMT
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Accept: text/xml
Set-Cookie: ITDEFILING=701055076661; Path=/e-Filing/; HttpOnly; Secure
Via: 1.1 ID-0002262016415314 uproxy-4
Transfer-Encoding: chunked
Connection: Keep-alive
Via: 1.1 ID-0002262044274430 uproxy-4
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><env:Fault xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>ns0:Client</faultcode><faultstring xml:lang="en">Authentication failed. Please provide a valid User ID and Password</faultstring></env:Fault></env:Body></env:Envelope>
答案 0 :(得分:0)
您是否确认它适用于SoapUI等常规肥皂客户端?