Results 1 to 6 of 6

Thread: SOAP and Applescript?

  1. #1
    mattjones99 is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    21

    Default SOAP and Applescript?

    Hello,

    I'd like to write an applescript to be able to add messages from Apple's Mail application into Sugar. This would certainly make it a sweeter application. :-) Sugar's SOAP interface seems like a great way to facilitate this connection. But, I can't even login using the SOAP interface.

    Here is my applescript:

    my create_session("username", "password")

    on create_session(in_user_name, in_password)
    tell application "http://iMacG5.local/sugarsuite/soap.php"
    set mn to "create_session"
    set sa to "http://iMacG5.local/sugarsuite/soap.php/create_session"
    set mns to "http://www.sugarcrm.com/sugarcrm"
    set params to {}
    set paramOrder to {}
    set params to params & {user_namein_user_name as string)}
    set paramOrder to paramOrder & "user_name"
    set params to params & {|password|in_password as string)}
    set paramOrder to paramOrder & "password"
    set params to params & {record orderaramOrder}
    return call soap {method name:mn, parametersarams, SOAPAction:sa, method namespace uri:mns}
    end tell
    end create_session
    And here are the errors from sugarcrm.log
    Tue May 3 16:11:22 2005,803 [17137] FATAL User - SECURITY: failed login by matt
    Tue May 3 16:11:22 2005,804 [17137] FATAL soap_contacts - SECURITY: failed attempted login for matt using SOAP api

    Help, advice, suggestions? I am certain that the correct username and password are in the actual script.

    As a side note, if anybody else is interested in using SOAP with Applescript, there is a really cool tool in the Develepor tools. Running the command /Developer/Tools/WSMakeStubs -url "http://imacg5.local/sugarsuite/soap.php?wsdl" -x applescript will stub out all the SOAP functions for you in applescript.

  2. #2
    rcourtna is offline Junior Member
    Join Date
    Jun 2005
    Posts
    3

    Default Re: SOAP and Applescript?

    Hi, did you ever get this working? If so, I'd be very interested in your applescript.

    Ryan

  3. #3
    mattjones99 is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    21

    Default Re: SOAP and Applescript?

    Ryan,

    Sorry, I got busy before I had time to work on it.

    If anybody else is interested in working on it, the key is that the password has to be an md5 hash of the password. I haven't figured out a way to create an md5 hash in applescript.

    Peace,

    Matt

  4. #4
    martinb is offline Sugar Community Member
    Join Date
    Jan 2005
    Posts
    36

    Default Re: SOAP and Applescript?

    Quote Originally Posted by mattjones99
    If anybody else is interested in working on it, the key is that the password has to be an md5 hash of the password. I haven't figured out a way to create an md5 hash in applescript.
    The hash is what's stored in the db - just grab it from the user_hash field in the users table:

    Code:
    SELECT *
    FROM `users`
    LIMIT 0 , 30
    Last edited by martinb; 2005-07-19 at 08:41 AM. Reason: Correcting [/QUOTE] tag

  5. #5
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: SOAP and Applescript?

    Have you checked out this quick start guide for the Sugar SOAP API's?

    http://www.sugarforge.org/frs/downlo...P_Overview.rtf

    Regards,
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  6. #6
    Shoe is offline Junior Member
    Join Date
    Jan 2006
    Posts
    4

    Default Re: SOAP and Applescript?

    I saw this at http://ruk.ca/code/PlazesAdium.txt and modified it a little


    Code:
    set passwordPlain to "mypassword"
    
    try
    	do shell script "/sbin/md5 -qs " & passwordPlain
    on error errMsg number errNo
    	error errMsg number errNo
    	return "failed"
    end try
    
    set passwordMD5 to result
    
    display dialog passwordMD5

    That should allow you to get the md5 from applescript.

    -Shoe

Thread Information

Users Browsing this Thread

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

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
  •