首先,请仔细阅读我的场景,WSDL文件是:https://203.196.200.42/cmspi/UCMSPAY/BusinessServices/StarterProcesses/CMS_Service.serviceagent?wsdl
示例请求XML是:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rev="http://www.tibco.com/schemas/CMS_Service/BusinessServices/Schemas/Rev_Input_Schema.xsd">
<soap:Header/>
<soap:Body>
<rev:reversal>
<rev:header>
<rev:req_id>01404099</rev:req_id>
<rev:msg_src>BTS</rev:msg_src>
<rev:client_code>KOSECNSE</rev:client_code>
<rev:date_post>2014-09-10T00:00:00+01:00</rev:date_post>
</rev:header>
<rev:details>
<!--Zero or more repetitions:-->
<rev:msg_id>CMS-2014062300007</rev:msg_id>
<rev:msg_id>CMS-2014062300013</rev:msg_id>
<rev:msg_id>CMS-2014062300010</rev:msg_id>
<rev:msg_id>CMS-2014062300016</rev:msg_id>
<rev:msg_id>CMS-2014042300008</rev:msg_id>
</rev:details>
</rev:reversal>
</soap:Body>
</soap:Envelope>
现在,我尝试使用PHP soapVar构建相同的上述示例请求,如下所示:
$soapClient = new SoapClient('https://203.196.200.42/cmspi/UCMSPAY/BusinessServices/StarterProcesses/CMS_Service.serviceagent?wsdl',
array('trace' => 1, "exceptions"=>0, 'soap_version' => SOAP_1_1) );
$soapClient->__setLocation('https://203.196.200.42/cmspi/UCMSPAY/BusinessServices/StarterProcesses/CMS_Service.serviceagent?wsdl');
$headerRequestVar = new SoapVar(array(
'rev:req_id' => '01404099',
'rev:msg_src' => 'BTS',
'rev:client_code' => 'KOSECNSE',
'rev:date_post' => '2014-09-10T00:00:00+01:00',
), SOAP_ENC_OBJECT);
$headerRequest = new SoapVar(array('rev:header' => $headerRequestVar), SOAP_ENC_OBJECT);
$detailsRequestVar = new SoapVar(array(
'rev:msg_id' => 'CMS-2014062300007',
), SOAP_ENC_OBJECT);
$detailsRequest = new SoapVar(array('rev:details' => $detailsRequestVar), SOAP_ENC_OBJECT);
$request = new SoapVar(array('rev:reversal' => $detailsRequest, $headerRequest), SOAP_ENC_OBJECT);
$result = $soapClient->WebAPI_rev($request);
var_dump($result);
当我运行上述程序时,我收到以下错误(Var_dump响应):
object(SoapFault)#7 (10) {
["message":protected]=>
string(13) "Wrong Version"
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(41) "/home/skumar/testme/kotak/soapClient3.php"
["line":protected]=>
int(37)
["trace":"Exception":private]=>
array(2) {
[0]=>
array(6) {
["file"]=>
string(41) "/home/skumar/testme/kotak/soapClient3.php"
["line"]=>
int(37)
["function"]=>
string(6) "__call"
["class"]=>
string(10) "SoapClient"
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
string(10) "WebAPI_rev"
[1]=>
array(1) {
[0]=>
object(SoapVar)#6 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(2) {
["rev:reversal"]=>
object(SoapVar)#5 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(1) {
["rev:details"]=>
object(SoapVar)#4 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(1) {
["rev:msg_id"]=>
string(17) "CMS-2014062300007"
}
}
}
}
[0]=>
object(SoapVar)#3 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(1) {
["rev:header"]=>
object(SoapVar)#2 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(4) {
["rev:req_id"]=>
string(8) "01404099"
["rev:msg_src"]=>
string(3) "BTS"
["rev:client_code"]=>
string(8) "KOSECNSE"
["rev:date_post"]=>
string(25) "2014-09-10T00:00:00+01:00"
}
}
}
}
}
}
}
}
}
[1]=>
array(6) {
["file"]=>
string(41) "/home/skumar/testme/kotak/soapClient3.php"
["line"]=>
int(37)
["function"]=>
string(10) "WebAPI_rev"
["class"]=>
string(10) "SoapClient"
["type"]=>
string(2) "->"
["args"]=>
array(1) {
[0]=>
object(SoapVar)#6 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(2) {
["rev:reversal"]=>
object(SoapVar)#5 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(1) {
["rev:details"]=>
object(SoapVar)#4 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(1) {
["rev:msg_id"]=>
string(17) "CMS-2014062300007"
}
}
}
}
[0]=>
object(SoapVar)#3 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(1) {
["rev:header"]=>
object(SoapVar)#2 (2) {
["enc_type"]=>
int(301)
["enc_value"]=>
array(4) {
["rev:req_id"]=>
string(8) "01404099"
["rev:msg_src"]=>
string(3) "BTS"
["rev:client_code"]=>
string(8) "KOSECNSE"
["rev:date_post"]=>
string(25) "2014-09-10T00:00:00+01:00"
}
}
}
}
}
}
}
}
}
["previous":"Exception":private]=>
NULL
["faultstring"]=>
string(13) "Wrong Version"
["faultcode"]=>
string(15) "VersionMismatch"
["faultcodens"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
}
当我在Firebug中查看时,它正在显示,状态为&#34; 200 OK&#34; ,有人知道,请发生什么事。我想,如果你看一下样本xml,它就会#34; &LT;反转&gt; &#34;父母有两个孩子&#34;&lt;标题&gt; &LT;详细信息&gt;&#34;,我在我的代码中传递了相同内容,如上所示:
$ request = new SoapVar(数组(&#39; rev:reversal&#39; =&gt; $ detailsRequest,$ headerRequest),SOAP_ENC_OBJECT);
你认为这是问题吗?