大家好,我碰到这样的问题,我在调用websevice的时候,端口可以链接成功,但是一直显示
错误 :soap:Client: The request element was not recognized. 这个我该如何解决?$json='{"Request":{"Header":{"IFCode":"接口标识","CorpCode":"客户代码","SysCode":"KongRun_BasicCode","Account":"账号","Pwd":"密码"},"Body":{"Integral":"10","MobilePhone":"手机号码"}}}';
$obj=json_decode($json);
 print_r($obj);  
//$param=array('MobilePhone'=>$MobilePhone,'Integral'=>$Integral);
$result=$client->call('DeductionIntegral',array('parameters'=>$obj));
//print_r($param);
  代码有错吗? ???

解决方案 »

  1.   

    没有看到 WSDL 不能确定 DeductionIntegral 的参数应该是怎样的
    但有一个原则是一定要遵守的:
    如果直接方法名访问是这样的话 $client->DeductionIntegral($param)
    那么用 call 方法访问就得这样 $client->call('DeductionIntegral',array($param))
    即参数要放在数组中,因为其内部调用了 call_user_func_array 函数
      

  2.   

    http://hr.pim-cs.com/WebService/IntegralInterface.asmx?wsdl,我直接用$client->call('DeductionIntegral',array($obj))这样子还是一样的错误提示,搞不懂呢!
      

  3.   

    显示参数传入不正确,我想问下,我这样调用对吗 ?
    $json='{"Request":{"Header":{"IFCode":"接口标识","CorpCode":"客户代码","SysCode":"KongRun_BasicCode","Account":"账号","Pwd":"密码"},"Body":{"Integral":"10","MobilePhone":"手机号码"}}}'; $obj=json_decode($json);  print_r($obj);   //$param=array('MobilePhone'=>$MobilePhone,'Integral'=>$Integral); $result=$client->call('DeductionIntegral',array('parameters'=>$obj)); 
      

  4.   

    他一共提供了2个方法
        [0] => DeductionIntegralResponse DeductionIntegral(DeductionIntegral $parameters)
        [1] => MemberAddIntegralResponse MemberAddIntegral(MemberAddIntegral $parameters)
    DeductionIntegral 方法需要一个 DeductionIntegral 类型的数据作为参数而 DeductionIntegral 类型是这样描述的:
    struct DeductionIntegral {
     string Json;
    }
    所以应该这样调用
    $param = array('Json' => $json);$client->call('DeductionIntegral',array($param));

    $client->DeductionIntegral($param);