II just started working with Sugar a few days ago, and have been mucking about with the SOAP interface quite a bit. I was hoping for some commentary on some of the mods that I have made. If there is either an easier or a better way to do any of the things that I have done I would love to hear about it so that I can avoid repeating my mistakes.
my intended goal was to write a Python script that would take an incoming email, and add the email address, name, and any other information it could glean from the email to a new lead in Sugar using soap.
Sadly the most developed python SOAP library SOAPpy can either control the order of method parameters or the name of them, but not both. Because of this I was forced to include a new file in soap.php in which I registered a new complex type
as well as a new function, which was pretty much just a wrapper for create_leadCode:$server->wsdl->addComplexType( 'create_leads_params', 'complexType', 'struct', 'all', '', array( 'user_name'=>array('name'=>'user_name', 'type'=>'xsd:string'), 'password'=>array('name'=>'password', 'type'=>'xsd:string'), 'first_name'=>array('name'=>'first_name', 'type'=>'xsd:string'), 'last_name'=>array('name'=>'last_name', 'type'=>'xsd:string'), 'email_address'=>array('name'=>'email_address', 'type'=>'xsd:string'), ) );
I was sort of surprised to find that the create_lead function defined in SOAP doesn't allow any of the many other contact fields to be filled in. (for instance if another application has phone numbers, names and emails and wants to pass them over to Sugar via SOAP a new function would need to be defined. Its easy enough to do, but the thought of drifting away from the main branch keeps me awake at night)Code:$server->register('create_lead_py', array('create_leads_params'=>'tns:create_leads_params'), array('return'=>'xsd:string'), $NAMESPACE); function create_lead_py($create_leads_params) { return (create_lead($create_leads_params['user_name'], $create_leads_params['password'], $create_leads_params['first_name'], $create_leads_params['last_name'], $create_leads_params['email_address'])); }
Does anyone know why the create_lead function is so minimalist?
Thanks for any advice.
-Harry


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks