PHP SoapClient版本不匹配

aks*_*ayb 2 php xml soap nusoap

除了此错误消息外,这里没有什么要写的:

SoapFault对象([消息:受保护] =>版本错误[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] =>否)))[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] =>数组([imiPolicy] =>数组([expiryDate] => 23-09-2013 [imiInsured] =>数组([item] => Array([item] => Array([age] = > 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] =>否)))))[inceptionDate] => 12-09-2009 [noOfInsured] => 1 [ partnerCode] => 2121 [stateCode] => 233))))))))[)上一页[Exception:private] => [faultstring] =>版本错误[faultcode] => VersionMismatch [faultcodens] =>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))))))))[)[错误字符串] =>版本错误[错误代码] => VersionMismatch [错误代码] =>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)))))))))[)[错误字符串] =>版本错误[错误代码] => VersionMismatch [错误代码] =>233))))))[previous:Exception:private] => [faultstring] =>版本错误[faultcode] => VersionMismatch [faultcodens] =>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日期:2013年9月17日,星期二16:55:39 GMT服务器:Apache / 2.2.22(Win64)PHP / 5.3.13上次修改时间:2013年9月17日星期二,格林尼治标准时间ETag:“ a0000000a818c-12e9-4e69428b54054”接受范围:字节内容长度:4841连接:close内容-输入: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);
}

?>
Run Code Online (Sandbox Code Playgroud)

您可以在此处找到wsdl(在与NuSOAP相关的问题中: WSDL客户端不起作用

Sve*_*ven 5

仔细研究该特定错误消息后发现,它可能与Soap 1.2版中的Soap服务器应答有关,而PHP中的默认设置是Soap 1.1版。

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