Heim  >  Artikel  >  Backend-Entwicklung  >  SOAP,碰到VersionMismatch,求解决

SOAP,碰到VersionMismatch,求解决

WBOY
WBOYOriginal
2016-06-13 12:04:341512Durchsuche

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 />		}

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn