首页  >  文章  >  后端开发  >  SOAP,碰到VersionMismatch,求解决

SOAP,碰到VersionMismatch,求解决

WBOY
WBOY原创
2016-06-13 12:04:341537浏览

SOAP,遇到VersionMismatch,求解决
先贴代码出来

<?php<br />header("Content-Type: text/html;charset=utf-8");  <br />try{  <br />    $client = new SOAPClient(null,<br />        array('location' =>"http://v2.shanxitele.com/service/OutWebService?wsdl",'uri' => "http://127.0.0.1/"));<br />   <br />    $servicename = 'OAuth';<br />    $servId = 'xxx';<br />    $secretKey = 'xxx';<br />    $xmlInfo = '<?xml version="1.0" encoding="UTF-8"?><BaseInfo><servId>fc4fa30c444400b701446c540230244e</servId><platform>yixin</platform><type>base</type><redirect_uri>lcoalhost/index.php</redirect_uri></BaseInfo>';<br /> <br />    $result = $client->callService($servicename, $servId, $secretKey, $xmlInfo);<br />    var_dump($result);<br />}catch(SOAPFault $e){  <br />    echo "Error: ",$e->faultcode,", string: ",$e->faultstring;<br />}  <br /><br />?>


记过错误代码Error: VersionMismatch, string: Wrong Version

求解决。
------解决方案--------------------
提供的方法<br />Array<br />(<br />    [0] => callServiceResponse callService(callService $parameters)<br />)<br />相关的数据结构<br />Array<br />(<br />    [0] => struct callService {<br /> string in0;<br /> string in1;<br /> string in2;<br /> string in3;<br />}<br />    [1] => struct callServiceResponse {<br /> string out;<br />}<br />)<br />
你总得按规矩来吧?
------解决方案--------------------
按照我这个来

try {<br />			$xml='xml数据';<br />			//地址<br />			$soap = new SoapClient ( "http://mp.vservice.com.cn/service/OutWebService?WSDL" );<br />			//请求参数 根据你的参数调整<br />			$param = array ('userName' => '*****', 'pwd' => '****', 'businessType' => 'SaleHouses', 'xmlContent' => $xml );<br />			//调用服务器端的方法 根据你的方法调整 我这里Import是方法名称<br />			$result = $soap->__soapCall ( 'Import', array ('parameters' => $param ) );<br />			print_r ( $result );<br />		} catch ( SoapFault $e ) {<br />			echo $e->getMessage ();<br />		} catch ( Exception $E ) {<br />			echo $E->getMessage ();<br />		}

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn