SOAP,遇到VersionMismatch,求解決

來源:互聯網
上載者:User
先貼代碼出來
"http://v2.shanxitele.com/service/OutWebService?wsdl",'uri' => "http://127.0.0.1/"));       $servicename = 'OAuth';    $servId = 'xxx';    $secretKey = 'xxx';    $xmlInfo = 'fc4fa30c444400b701446c540230244eyixinbaselcoalhost/index.php';     $result = $client->callService($servicename, $servId, $secretKey, $xmlInfo);    var_dump($result);}catch(SOAPFault $e){      echo "Error: ",$e->faultcode,", string: ",$e->faultstring;}  ?>


記過錯誤碼Error: VersionMismatch, string: Wrong Version

求解決。


回複討論(解決方案)

提供的方法Array(    [0] => callServiceResponse callService(callService $parameters))相關的資料結構Array(    [0] => struct callService { string in0; string in1; string in2; string in3;}    [1] => struct callServiceResponse { string out;})
你總得按規矩來吧?

按照我這個來

try {$xml='xml資料';//地址$soap = new SoapClient ( "http://mp.vservice.com.cn/service/OutWebService?WSDL" );//請求參數 根據你的參數調整$param = array ('userName' => '*****', 'pwd' => '****', 'businessType' => 'SaleHouses', 'xmlContent' => $xml );//調用伺服器端的方法 根據你的方法調整 我這裡Import是方法名稱$result = $soap->__soapCall ( 'Import', array ('parameters' => $param ) );print_r ( $result );} catch ( SoapFault $e ) {echo $e->getMessage ();} catch ( Exception $E ) {echo $E->getMessage ();}

提供的方法Array(    [0] => callServiceResponse callService(callService $parameters))相關的資料結構Array(    [0] => struct callService { string in0; string in1; string in2; string in3;}    [1] => struct callServiceResponse { string out;})
你總得按規矩來吧?


額,我新手,之前沒有接觸過Soap,可以幫我貼出一個完整的代碼嗎?非常感謝

按照我這個來

try {$xml='xml資料';//地址$soap = new SoapClient ( "http://mp.vservice.com.cn/service/OutWebService?WSDL" );//請求參數 根據你的參數調整$param = array ('userName' => '*****', 'pwd' => '****', 'businessType' => 'SaleHouses', 'xmlContent' => $xml );//調用伺服器端的方法 根據你的方法調整 我這裡Import是方法名稱$result = $soap->__soapCall ( 'Import', array ('parameters' => $param ) );print_r ( $result );} catch ( SoapFault $e ) {echo $e->getMessage ();} catch ( Exception $E ) {echo $E->getMessage ();}



這個我運行後出來的資訊是這樣的,stdClass Object ( [out] => )

你的使用者名稱和口令真實嗎?

你的使用者名稱和口令真實嗎?



是真實的,

方法已經給你了,但你又不可能全部提供正確的參數
所以調試只能你自己完成了

方法已經給你了,但你又不可能全部提供正確的參數
所以調試只能你自己完成了



1、擷取網頁授權URL介面
?介面地址 http://v2.shanxitele.com/service/OutWebService?wsdl
?介面調用方
callService(String serviceName,String servId,String secretKey,String xmlInfo)
?介面輸入參數
參數名稱 傳值
serviceName OAuth
servId 服務號id 太原電信=fc4fa30c444400b701446c540230244e
secretKey 服務號秘鑰 太原電信=96e79218965eb72c92a549dd5a330112
xmlInfo


xxx
yixin
base
uri


拜託了。這個實在是不懂。

try{      $client = new SOAPClient("http://v2.shanxitele.com/service/OutWebService?wsdl",        array('uri' => "http://v2.shanxitele.com/"));    $servicename = 'OAuth';    $servId = 'fc4fa30c444400b701446c540230244e';    $secretKey = '96e79218965eb72c92a549dd5a330112';    $xmlInfo = 'fc4fa30c444400b701446c540230244eyixinbaselcoalhost/index.php';  $data = array('in0' => $servicename, 'in1' => $servId, 'in2'=>$secretKey, 'in3'=>$xmlInfo);    $result = $client->callService($data);    $rs = simplexml_load_string($result->out, 'SimpleXMLElement', LIBXML_NOCDATA);    print_r($rs);}catch(SOAPFault $e){      echo "Error: ",$e->faultcode,", string: ",$e->faultstring;}

try{      $client = new SOAPClient("http://v2.shanxitele.com/service/OutWebService?wsdl",        array('uri' => "http://v2.shanxitele.com/"));    $servicename = 'OAuth';    $servId = 'fc4fa30c444400b701446c540230244e';    $secretKey = '96e79218965eb72c92a549dd5a330112';    $xmlInfo = 'fc4fa30c444400b701446c540230244eyixinbaselcoalhost/index.php';  $data = array('in0' => $servicename, 'in1' => $servId, 'in2'=>$secretKey, 'in3'=>$xmlInfo);    $result = $client->callService($data);    $rs = simplexml_load_string($result->out, 'SimpleXMLElement', LIBXML_NOCDATA);    print_r($rs);}catch(SOAPFault $e){      echo "Error: ",$e->faultcode,", string: ",$e->faultstring;}



非常感謝。
  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.