PHP SoapClient版本不匹配

时间:2013-09-17 16:58:55

标签: php xml soap nusoap

除了此错误消息之外,此处没有太多要写的内容:

SoapFault对象([message:protected] =>错误的版本[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] =>数组([0] => getIMIPremium [1] =>数组([0] =>数组([imiPolicy] =>数组([expiryDate] => 23-09-2013 [imiInsured] =>数组([item] =>数组([item] ] =>数组([age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no)))[inceptionDate ] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233)))))[1] =>数组([file] => C :\ wamp \ www \ nsoap \ phpclient.php [line] => 10 [function] => getIMIPremium [class] => SoapClient [type] => - > [ar gs] =>数组([0] =>数组([imiPolicy] =>数组([expiryDate] => 23-09-2013 [imiInsured] =>数组([item] =>数组([item] => ;数组([age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no)))[inceptionDate] =&gt ; 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233)))))[previous:Exception:private] => [faultstring] =>错误版本[faultcode] => VersionMismatch [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => (!)SoapFault:第10行C:\ wamp \ www \ nsoap \ phpclient.php中的错误版本调用堆栈#TimeMemoryFunctionLocation 10.0009674576 {main}().. \ phpclient.php:0 20.0704702744SoapClient-> getIMIPremium()。 。\ phpclient.php:10)

客户端php代码中是否可能存在错误?我已经尝试了NuSoap,但它也产生了错误“调用错误:响应不是类型text / xml:application / wsdl + xmlHTTP / 1.1 200 OK日期:星期二,17九月2013 16:55:39 GMT服务器:Apache / 2.2.22(Win64)PHP / 5.3.13最后修改日期:2013年9月17日星期二13:18:39 GMT ETag:“a0000000a818c-12e9-4e69428b54054”接受范围:字节内容长度:4841连接:关闭内容 - 键入:application / wsdl + xml“。

你知道任何修复方法吗?

PHP代码:

<?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);
}

?>

你可以在这里找到wsdl(在我的问题中与NuSOAP相关: WSDL Client Not Working

1 个答案:

答案 0 :(得分:4)

使用该特定错误消息进行的一些谷歌搜索显示,它可能与Soap版本1.2中的Soap服务器应答有关,而PHP中的默认设置是Soap版本1.1。

尝试将选项数组添加到SoapClient,并将array('soap_version'=> SOAP_1_2)作为第二个参数(有关详细信息,请参阅http://de1.php.net/manual/en/soapclient.soapclient.php)。