Results 1 to 5 of 5

Thread: Soap/ Nusoap and php 5.2.9

  1. #1
    spiderglobe is offline Junior Member
    Join Date
    Dec 2008
    Posts
    3

    Default Soap/ Nusoap and php 5.2.9

    After upgrading to PHP 5.2.9 I had an issue with the sugar SOAP interface when submitting a query within a soap request.

    When I made the following request to get all related contacts from an account with a where clause I got a error response within the nusoap that the SQL query was not correct. Issue was that the quotes ' where filter out (replaced by spaces).

    I made the following request (from Joomla):
    PHP Code:
    $cache = new nusoap_wsdlcacheJPATH_BASE DS 'cache'86400);
            
    $url $this->portal_config->sugarhost '/soap.php?wsdl';
            
            
    $wsdl $cache->get$url);
            if(
    is_null($wsdl))    {
                  
    $wsdl = new wsdl($url''''''''5);
                  
    $cache->put($wsdl);
            }        
            
    // Pick up the sugar session id;
            
    $sugar_session_id $session->get('session_id'null'SUGAR' );
            
    $client = new nusoap_client$wsdl'wsdl'    );

            
    $client->debugLevel 0;
            if ( 
    $sugar_session_id == null ) {
                    
    $auth_array = array( 'user_auth' => array (
                                            
    'user_name' => $this->portal_config->sugar_username,
                                            
    'password'     => md5($this->portal_config->sugar_password),
                )
                );
                
    $login_results $client->call('login',$auth_array);
                
    $sugar_session_id $login_results['id'];

                
    // Save the session id of Sugar;
                
    $session->set("session_id",     $sugar_session_id,    'SUGAR'    );
            }
            
            
    $set_rel_params = array(
                                          
    'session' => $sugar_session_id,
                                          
    'set_relationship_value'=> $sugar_relation
                                    
    );
        
            
    $return_fields =  array( 'id''first_name''last_name''email1' );                        

            
    $accounts_id JRequest::getvar'id'        '0'    );
            
    $search_filter  " account_id = '" $accounts_id "'";
            
    $client->use_curl true;
            
            
            
    $record_list $client->call'get_entry_list', array( $sugar_session_id'Contacts'$search_filter 'last_name' 0$return_fields10)); 
    The issue was in the Query, in the example the search_filter:
    PHP Code:
    $search_filter  " account_id = '" $accounts_id "'"
    When this request was made to sugarcrm the XML request arrived correctly and the quote was correctly replaced into ' entity with the XML request. Normally this &apos is then replaced in the XML response with a single quote ' but since php 5.2.9. this was no longer the case.

    Solution that I've added is to adjust the nusoap class within sugar:
    /include/nusoap/nusoap.php

    Goto the function service (arround line 3259) and place the following line into it:
    PHP Code:
    function service($data){
            global 
    $HTTP_SERVER_VARS;

            
    $data ereg_replace("'","'",$data); 
    Have checked and tested it and it solves my issue.

    Richard
    Platform used: centos 5.2 / PHP 5.2.9

  2. #2
    serbanghita is offline Sugar Community Member
    Join Date
    Jan 2009
    Location
    Bucharest
    Posts
    42

    Post Re: Soap/ Nusoap and php 5.2.9

    Excellent post! This is a common issue with get_entry_list when using query parameter (eg.'query' => ' name = \''.$contract_name.'\' ')

    I had issues with php 5.2.8 and SugarCRM PRO.
    This issue is fixed with php 5.2.10, you no longer need any patch.

    SugarCRM should make SoapClient alternative to nusoap class to those who support the extension.

  3. #3
    alex3232 is offline Senior Member
    Join Date
    May 2009
    Posts
    73

    Default No Search results, Sugar CE5.5

    Hi ,

    My Sugar CE5.5 works fine , the Thin Client open but no search results are displayed.
    I've modified the nusoap.php as described here and setup permission to 755 on the /thin folder but still I can't get any search results (even using %text_string% )

    please do you have any clue ?
    many thanks

  4. #4
    AlexAv's Avatar
    AlexAv is offline Sugar Community Member
    Join Date
    Oct 2009
    Location
    Ukraine
    Posts
    922

    Default Re: No Search results, Sugar CE5.5

    Quote Originally Posted by alex3232 View Post
    Hi ,

    My Sugar CE5.5 works fine , the Thin Client open but no search results are displayed.
    I've modified the nusoap.php as described here and setup permission to 755 on the /thin folder but still I can't get any search results (even using %text_string% )

    please do you have any clue ?
    many thanks
    Do you have any warnings. notices in the apache log?
    Letrium ltd. - Only high quality service
    http://letrium.com

  5. #5
    AlexAv's Avatar
    AlexAv is offline Sugar Community Member
    Join Date
    Oct 2009
    Location
    Ukraine
    Posts
    922

    Default Re: Soap/ Nusoap and php 5.2.9

    Try add echo 'good'; to the end of file. Do you see mess?
    Letrium ltd. - Only high quality service
    http://letrium.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sugar SOAP and NuSOAP over VPN
    By josh.sweeney in forum Developer Help
    Replies: 5
    Last Post: 2010-02-22, 07:11 PM
  2. getting started with SOAP / nusoap
    By tbivans in forum Developer Help
    Replies: 35
    Last Post: 2008-09-06, 01:52 PM
  3. nusoap vs. soap: which to use and why?
    By hanmari in forum General Discussion
    Replies: 6
    Last Post: 2008-05-12, 05:20 PM
  4. Soap + Nusoap
    By toad in forum Deutsche
    Replies: 0
    Last Post: 2008-02-28, 09:28 AM
  5. Replies: 1
    Last Post: 2007-02-11, 09:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •