/** * 函数功能:原创调用适配 */ function remoteInvoke($service, $parameter) { // 合成XML $xdoc = new CreateXML($this->encoding); $xdoc->createRoot($service, $this->version); foreach ($parameter as $key => $val) { $xdoc->addNode($key, $val['type'], $val['value']); } // 加密 签名 $xstr = $xdoc->getString(); // echo "xstr: $xstr"; $req_sign = strtoupper(md5($xstr . $this->md5key)); $req_code = base64_encode($xstr); // 远程调用 //生成SOAP调用是的参数 $param = array('service' => $service, 'merchant' => $this->merchantid, 'encoding' => $this->encoding, 'type' => $this->type, 'code' => $req_code, 'sign' => $req_sign); // print_r($param); //调用网银提供的soap方法 $soap_client = new soapclientw($this->soap_url, true); $rs = $soap_client->call($this->soap_method, $param); //echo "-----------------------------<br/>\n"; //print_a('rs', $rs); // 处理返回值 $rtcode = $rs['string'][0]; $rtmsg = base64_decode($rs['string'][1]); //echo "code: $rtmsg<br\>\n"; if (strtoupper(md5($rtmsg . $this->md5key)) == $rs['string'][2]) { echo "return sign OK! <br>\n"; // 解码 echo $rtmsg; return xml2array($rtmsg); } else { echo "Chinabank Soap SIGN ERR! <br>\n"; return array('sname' => $service, 'result' => $this->MOTO_CLIENT_AUTH, 'error' => $this->MOTO_CLIENT_AUTH, '_error' => 'SING ERR'); } }