先貼代碼出來
"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;}
非常感謝。