• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

SOAP,遇到VersionMismatch,求解决

php 搞代码 4年前 (2022-01-23) 30次浏览 已收录 0个评论
文章目录[隐藏]

先贴代码出来

<?phpheader("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 = '<?xml version="1.0" encoding="UTF-8"?>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" );			//请求参数 根据你的参数调整	<strong>+本文来源gao@daima#com搞(%代@#码网</strong><pre>搞代gaodaima码

$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
<?xml version=”1.0″ encoding=”UTF-8″?>

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 = '<?xml version="1.0" encoding="UTF-8"?>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 = '<?xml version="1.0" encoding="UTF-8"?>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;}

非常感谢。


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:SOAP,遇到VersionMismatch,求解决

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址