[Vtigercrm-commits] [vtiger development] #6210: Web Services API issues

vtiger development vtiger-tickets at trac.vtiger.com
Wed Jul 29 09:42:42 EDT 2009


#6210: Web Services API issues
-----------------------------+----------------------------------------------
 Reporter:  vitalidze        |       Owner:  developer
     Type:  defect           |      Status:  new      
 Priority:  unassigned       |   Milestone:  5.1.1    
Component:  vtwsclib         |     Version:  5.1.0    
 Keywords:  web service api  |  
-----------------------------+----------------------------------------------
 There are several issues in a new Web Services API.

 1) Wrong "Content-Type" in http headers of webservice.php. I assume it
 should be "application/json", but they are "text/html". This issue prevent
 [http://jersey.dev.java.net jersey] java library, which we are using to
 connect our java application to your web services, to properly convert
 JSON objects to Java objects. As a quick fix I've added:
 {{{
 header("Content-type: application/json");
 }}}
 to the top of '''webservice.php''' file. The quick fix is to modify line

 2) When trying to execute such query using query method of webservice.php:
 {{{
 select * from Users;
 }}}
 I get this output:
 {{{
 {"success":false,"error":{"code":"DATABASE_QUERY_ERROR","message":"Database
 error while performing required operation"}}
 }}}
 If you want I will provide php or java code to reproduce the problem. It
 reproduces even if I invoke it from browser like:
 {{{
 http://localhost/vtigercrm/webservice.php?operation=query&sessionName=c5cecc94a701ad52a9be&query=select
 * from Users;
 }}}
 After some reverse engineering I've found that the problem is in SQL query
 being generated after parsing your meta-query:
 {{{
 SELECT
 vtiger_users.accesskey,vtiger_users.activity_view,...,vtiger_users.id FROM
 vtiger_users LEFT JOIN vtiger_asteriskextensions ON
 vtiger_users.id=vtiger_asteriskextensions.userid LEFT JOIN
 vtiger_user2role ON vtiger_users.id=vtiger_user2role.userid WHERE  LIMIT
 100;
 }}}
 As you can see there is an '''WHERE''' keyword with missing clauses. The
 quick fix is to modify line 274 of '''VTQL_Parser.php''' from:
 {{{
 $this->query = $this->query." WHERE ";
 }}}
 to:
 {{{
 if ($this->out['moduleName'] != "Users"){
 $this->query = $this->query." WHERE ";
 }
 }}}
 I assume this query is built in some special way for User entities, so
 possibly this 'If' was forgotten.

-- 
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/6210>
vtiger development <http://trac.vtiger.com/>
vtigerCRM




More information about the vtigercrm-commits mailing list