您的位置:首页 > 编程语言 > PHP开发

php 调用 java webservice

2011-07-25 13:57 393 查看
public function soap($path, $param)
    {
        try {
            $client = new Zend_Soap_Client ( $this->_wsdl_url );
            $options ['soap_version'] = 1;
            $client->setOptions ( $options );
            foreach ( $param as $k => $v ) {
                $serviceParams ['request'] ['data'] ['entry'] [] = array ('key' => $k, 'value' => $v );
            }
            $serviceParams ['request'] ['servicePath'] = $path;
            //My120_Mydebug::myjump($client);exit;
            $resultWebservice = $client->service ( $serviceParams );
            
            $arr = $this->objectToArray ( $resultWebservice );
            
            $res['success'] = $arr['response']['success'];
            foreach ($arr['response']['data'] as $k=>$v) {
                $res[$v['key']] = $v['value'];
            }
            
            return $res;
        } catch ( Exception $e ) {
            return $e->getMessage ();
        }
    }\
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息