PHP SoapClient Version Mismatch [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-10 22:21:10

问题


There is nothing too much to write here other than this error message :

SoapFault Object ( [message:protected] => Wrong Version [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\nsoap\phpclient.php [line:protected] => 10 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => getIMIPremium [1] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [1] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => getIMIPremium [class] => SoapClient [type] => -> [args] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [previous:Exception:private] => [faultstring] => Wrong Version [faultcode] => VersionMismatch [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: Wrong Version in C:\wamp\www\nsoap\phpclient.php on line 10 Call Stack #TimeMemoryFunctionLocation 10.0009674576{main}( )..\phpclient.php:0 20.0704702744SoapClient->getIMIPremium( )..\phpclient.php:10 )

Is it possible that there is an error in the client php code for it ? I have tried NuSoap, but it is also generating error that "Call error: Response not of type text/xml: application/wsdl+xmlHTTP/1.1 200 OK Date: Tue, 17 Sep 2013 16:55:39 GMT Server: Apache/2.2.22 (Win64) PHP/5.3.13 Last-Modified: Tue, 17 Sep 2013 13:18:39 GMT ETag: "a0000000a818c-12e9-4e69428b54054" Accept-Ranges: bytes Content-Length: 4841 Connection: close Content-Type: application/wsdl+xml ".

Do you know any fix for it ?

PHP Code :

<?php

try{


$client = new SoapClient("http://mysite.com/nsoap/IMIPremiumWebService.wsdl");


$args= array("imiPolicy" => array("expiryDate" => "23-09-2013", "imiInsured" =>array("item" => array("item" => array("age"=>'23', "basicSumInsured"=>'33233', "coverRageType"=>'12',"dateOfBirth"=>'26-09-1986',"preExistingDisease" => 'no'))), "inceptionDate"=>"12-09-2009" ,"noOfInsured"=>'1',"partnerCode" => '2121', "stateCode" => '233'));
$something =  $client->getIMIPremium($args);
echo $client->responseData;


print_r($something);
}
catch (Exception $e)
{

    echo "*****************";
    print_r($e);
}

?>

You can find wsdl here (in my question related to NuSOAP: WSDL Client Not Working


回答1:


A little bit of googling with that particular error message reveals that it might be related to the Soap server answering in Soap version 1.2, while the default setting in PHP is Soap version 1.1.

Try adding an options array to the SoapClient with array('soap_version'=> SOAP_1_2) as the second parameter (see http://de1.php.net/manual/en/soapclient.soapclient.php for details).



来源:https://stackoverflow.com/questions/18855653/php-soapclient-version-mismatch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!