SOAP,遇到VersionMismatch,求解決
先貼代碼出來
header("Content-Type: text/html;charset=utf-8");
try{
$client = new SOAPClient(null,
array('location' =>"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 ();
}