PHP SoapClient 版本不匹配 [英] PHP SoapClient Version Mismatch

查看:26
本文介绍了PHP SoapClient 版本不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了这个错误信息,这里没有什么可写的:

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

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] => 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 [出生日期] => 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] =>数组 ( [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] => 错误版本 [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)

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 )

客户端的php代码有没有可能出错?我尝试过 NuSoap,但它也产生了错误:调用错误:响应不是文本/xml 类型:应用程序/wsdl+xmlHTTP/1.1 200 OK 日期:2013 年 9 月 17 日星期二 16:55:39 GMT 服务器: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: 4 bytes Content-Connection类型:application/wsdl+xml".

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 代码:

<?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 客户端不工作

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

推荐答案

在谷歌上搜索该特定错误消息后发现它可能与 Soap 1.2 版中的 Soap 服务器应答有关,而 PHP 中的默认设置是肥皂 1.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.

尝试使用 array('soap_version'=> SOAP_1_2) 作为第二个参数向 SoapClient 添加一个选项数组(请参阅 http://de1.php.net/manual/en/soapclient.soapclient.php 了解详情).

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).

这篇关于PHP SoapClient 版本不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆