Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: SOAP help

  1. #1
    Dustin09 is offline Senior Member
    Join Date
    Dec 2009
    Posts
    29

    Default SOAP help

    Sugar 5.2.0k
    I am wanting to get a certain ID to display in SOAP, and show information for just that ID. Would also like to be able to update that ID's information through SOAP. any help/tutorials? I'm working with the SoapTest.php files
    thanks

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,811

    Default Re: SOAP help

    Take a look at the Dev Guide and Developers site (http://developers.sugarcrm.com)

    In a nutshell, you can retrieve data using the method get_entry_list()

    That'll give you the ID values of the records that meet your criteria. To update the record, use the set_entry() method, passing the specific ID of the record to be updated as one of the values.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  3. #3
    Dustin09 is offline Senior Member
    Join Date
    Dec 2009
    Posts
    29

    Default Re: SOAP help

    I'm not having any luck. Basically I want to show a Customer Number in a custom module called Customers.

    When I load the page it's blank.
    I have it in my examples directory
    PHP Code:
    <?php
            
    require_once("../include/nusoap/nusoap.php");
            class 
    SugarSoap{
                    var 
    $proxy;
                    var 
    $sess;
                    function 
    SugarSoap($soap_url,$login=true){
                            
    $soapclient = new soapclient($soap_url,true);
                            
    $this->proxy $soapclient->getProxy();
                            if(
    $login$this->login();
                    }
            }
    function 
    login(){
        
    $params = array(
            
    'user_name' => 'admin',
            
    'password'  => md5('MYpass'),
            
    'version'   => '.01'
        
    );
        
    $result $this->proxy->login($params,'MyApp');
        
    $this->sess$result['error']['number']==$result['id'] : null;
        return 
    $this->sess;

    function 
    get LIN_Customer($query='',$maxnum=0,$orderby=' LIN_Customer.lname asc'){
        
    $result $this->proxy->get_entry_list(
            
    $this->sess,
            
    'Customers',
            
    $query,
            
    $orderby,
            
    0,
            array(
                
    'cust_no',
                
    'fname',
                
    'lname',
                
    'co_name',
            ),
            
    $maxnum,
            
    false
        
    );
        return 
    $result;

    ?>
    I think the error is in this line,
    PHP Code:
    function get LIN_Customer($query='',$maxnum=0,$orderby=' LIN_Customer.lname asc'){ 
    It is actually suppose to be, getLIN_Customer($.... right? but still don't get results for that.
    Last edited by Dustin09; 2010-01-20 at 04:09 PM.

  4. #4
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: SOAP help

    At these sticking points I usually start entering a bunch of debug code such as echo "here 1"; etc to find out where it's failing. Outputting variable values helps a ton as well.

  5. #5
    Dustin09 is offline Senior Member
    Join Date
    Dec 2009
    Posts
    29

    Default Re: SOAP help

    lol, That's how I knew which line was screwing up.

  6. #6
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: SOAP help

    Looks like the function name has a space in it: get LIN_Customer. Try renaming to something else like get_LIN_Customer. Then you'll need to call that function at some point to kick it off.

  7. #7
    Dustin09 is offline Senior Member
    Join Date
    Dec 2009
    Posts
    29

    Default Re: SOAP help

    This displays, HELLO HELLO 2 HELLO3. So it seems to be okay. Is there not an easier way to work with SOAP/PHP ? I don't know what the hell I'm doing.
    PHP Code:
    <?php
    echo "HELLO";
            require_once(
    "../include/nusoap/nusoap.php");
            class 
    SugarSoap{
                    var 
    $proxy;
                    var 
    $sess;
                    function 
    SugarSoap($soap_url,$login=true){
                            
    $soapclient = new soapclient($soap_url,true);
                            
    $this->proxy $soapclient->getProxy();
                            if(
    $login$this->login();
                    }
            }
    function 
    login(){
        
    $params = array(
            
    'user_name' => 'admin',
            
    'password'  => md5('MYpass'),
            
    'version'   => '.01'
        
    );
        
    $result $this->proxy->login($params,'MyApp');
        
    $this->sess$result['error']['number']==$result['id'] : null;
        return 
    $this->sess;

    echo 
    " HELLO 2";
    function 
    getLIN_Customer($query='',$maxnum=0,$orderby=' LIN_Customer.lname asc'){
        
    $result $this->proxy->get_entry_list(
            
    $this->sess,
            
    'Customers',
            
    $query,
            
    $orderby,
            
    0,
            array(
                
    'cust_no',
                
    'fname',
                
    'lname',
                
    'co_name',
            ),
            
    $maxnum,
            
    false
        
    );
        return 
    $result;

        echo 
    " HELLO3";
    ?>

  8. #8
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: SOAP help

    Looks fine. You need to actually call the function though at some point. Such as after your hello3 do this:
    getLIN_Customer();

    This will get you inside your function. You'll need to do more work to get it to do what you want though.

  9. #9
    Dustin09 is offline Senior Member
    Join Date
    Dec 2009
    Posts
    29

    Default Re: SOAP help

    Well thank you very much. There is nothing put together by anyone to do this easier by chance?

  10. #10
    Poynton is offline Senior Member
    Join Date
    Mar 2009
    Posts
    75

    Default Re: SOAP help

    hi

    im trying to do the same sort of thing, any luck on finding any examples / do you have code you could share with the community a i think it would be really useful!?

    thanks!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SOAP - setting email for contact via soap
    By darcy.rippon in forum Developer Help
    Replies: 3
    Last Post: 2008-09-22, 08:13 PM
  2. SOAP and SQL
    By noob2k9 in forum Developer Help
    Replies: 0
    Last Post: 2008-09-02, 09:46 AM
  3. About SOAP
    By Ksagitarius in forum Help
    Replies: 0
    Last Post: 2005-09-27, 05:20 AM
  4. Changes in SOAP API from 3.0 to 3.5???
    By dtobias in forum Developer Help
    Replies: 0
    Last Post: 2005-09-18, 02:12 AM
  5. SOAP to SugarCRM using PEAR SOAP?
    By ryaker in forum General Discussion
    Replies: 0
    Last Post: 2005-04-12, 07:23 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
  •