Results 1 to 4 of 4

Thread: EmailAddresses module set_entry with soap

  1. #1
    pcordonet is offline Junior Member
    Join Date
    Jan 2011
    Posts
    4

    Default EmailAddresses module set_entry with soap

    Hi,

    Estoy probando el protocolo soap, para integrar en mi aplicacion sugar.


    Cuano intento crear un nuevo registro de EmailAddress, con la función set_entry no me devuelve el nuevo ID. Tampoco me crea el registro en la base de datos.

    Aqui pongo un ejemplo:

    Mi xml es:
    Code:
    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
       <soapenv:Header/>
       <soapenv:Body>
          <sug:set_entry soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
             <session xsi:type="xsd:string">nn9r9l47i1ijjcb88or4ar7b45</session>
             <module_name xsi:type="xsd:string">EmailAddresses</module_name>
    	 <name_value_list soapenc:arrayType="sug:name_value[3]" xsi:type="sug:name_value_list">
    		<item xsi:type="tns:name_value">
       			<name xsi:type="xsd:string">id</name>
    			<value xsi:type="xsd:string"></value>
    		</item>
    		<item xsi:type="tns:name_value">
       			<name xsi:type="xsd:string">email_address</name>
    			<value xsi:type="xsd:string">xxxxxxx@xxxxx.xxxxx.com</value>
    		</item>
    		<item xsi:type="tns:name_value">
       			<name xsi:type="xsd:string">email_address_caps</name>
    			<value xsi:type="xsd:string">XXXXXXX@XXXXX.XXXXX.COM</value>
    		</item>
            </name_value_list>
          </sug:set_entry>
       </soapenv:Body>
    </soapenv:Envelope>
    Mis comandos són :

    Code:
    cSoapUrl:= http://localhost/sugarce/service/v3/soap.php?wsdl
    
    cXml:= ( is xml code )
    ::objXMLHTTP:open( "post", cSoapUrl , .f. )
    ::objXMLHTTP:setRequestHeader("Accept-Encoding","gzip,deflate")
    ::objXMLHTTP:setRequestHeader("content-type","text/xml;charset=UTF-8")
    ::objXMLHTTP:send( cXml )
    
    xXmlReturn:=  ::objXMLHTTP:responseText
    el xml que me devuelve és:

    Code:
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.sugarcrm.com/sugarcrm">
       <SOAP-ENV:Body>
          <ns1:set_entryResponse xmlns:ns1="http://www.sugarcrm.com/sugarcrm">
             <return xsi:type="tns:new_set_entry_result">
                <id xsi:type="xsd:string"/>
             </return>
          </ns1:set_entryResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Espero alguna ayuda.
    Gracias.
    Pere
    Last edited by pcordonet; 2011-01-26 at 09:30 AM.

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

    Default Re: EmailAddresses module set_entry with soap

    No se puede acceder directamente.

    Para agregar una direccion email, agregela via el campo 'email1' o 'email2' (o los dos) cuando agrege algun registro al modulo Contacts, Leads o Accounts.
    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
    pcordonet is offline Junior Member
    Join Date
    Jan 2011
    Posts
    4

    Default Re: EmailAddresses module set_entry with soap

    He estado probando email1en cuentas y contactos, cuando abro el sugarce en el contacto me dice no tiene emails.

    Tambien he probado set_entry en las versiones 1,2, 2.1 y 3 y ninguna me da de alta el email.

    No seria mas lógico poder dar de alta emails y luego hacer la relación?

    He estado haciendo pruebas:
    Con xml no funciona pero son soapclient de php si funciona.
    Ejemplo en php que si funciona:
    Code:
    <?php 
    //user authentication array 
    $user_auth = array('user_name' => "xxx",'password' => MD5("xxxx"),'version' => ".01"); 
    
    // connect to soap server 
    $client = new SoapClient('http://localhost/SugarCE/soap.php?wsdl'); 
    
    // Login to SugarCRM 
    $response = $client->login($user_auth,"test"); 
    $session = $response->id; 
    print "Session: $session\n";
    # Now try to update a single array entry.
    $entry = array(array("name" => 'id',"value" => 'cb66b549-c43f-1e23-d811-4d317554bea7'),
    	                 array("name" => 'email1',"value" => 'xxxx@xxxx.com') );
    	
    print "Set_entry with one item\n";
    $result = $client->set_entry($session, 'Accounts', $entry);
    print "Entry:\n";
    print_r($entry);
    print "Response:\n";
    print_r($result);
    pero yo trabajo en XMLHTTP

    Por tanto mi xml de envio es este. ( el identicador se sesión es correcto y el id de Cuentas tambíen)
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header/>
    <soapenv:Body>
    <sug:set_entry soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <session xsi:type="xsd:string">cqspcc29q22cv8o1udpkmjc224</session>
    <module_name xsi:type="xsd:string">Accounts</module_name>
    <name_value_list soapenc:arrayType="sug:name_value[2]" xsi:type="sug:name_value_list">
    <item xsi:type="tns:name_value">
    <name xsi:type="xsd:string">id</name>
    <value xsi:type="xsd:string">cb66b549-c43f-1e23-d811-4d317554bea7</value>
    </item>
    <item xsi:type="tns:name_value">
    <name xsi:type="xsd:string">email1</name>
    <value xsi:type="xsd:string">pxxxcxxxxxxx@aplitec.com                </value>
    </item>
    </name_value_list>
    </sug:set_entry>
    </soapenv:Body>
    </soapenv:Envelope>
    Y este me devuelve:

    Code:
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.sugarcrm.com/sugarcrm">
       <SOAP-ENV:Body>
          <ns1:set_entryResponse xmlns:ns1="http://www.sugarcrm.com/sugarcrm">
             <return xsi:type="tns:new_set_entry_result">
                <id xsi:type="xsd:string">cb66b549-c43f-1e23-d811-4d317554bea7</id>
             </return>
          </ns1:set_entryResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Pero no me da de alta el email.

    Me podrias decir donde esta el fallo?
    Muchas gracias.

    Muchas gracias por la respuesta.
    Pere.
    Last edited by pcordonet; 2011-01-26 at 04:12 PM.

  4. #4
    pcordonet is offline Junior Member
    Join Date
    Jan 2011
    Posts
    4

    Default Re: EmailAddresses module set_entry with soap

    Ya he encontrado el fallo!!!!


    En la direccion email no puede haber espacios.

    Muchas Gracias.
    Pere

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SOAP call get_entry for EmailAddresses
    By Editha in forum Help
    Replies: 4
    Last Post: 2009-06-12, 08:11 AM
  2. How do I retrieve EmailAddresses using SOAP ? (Sugar v5.0+)
    By ludoviclange in forum Developer Help
    Replies: 6
    Last Post: 2008-12-04, 07:02 PM
  3. SOAP: set_entry not working
    By Developer58 in forum Developer Help
    Replies: 7
    Last Post: 2008-09-09, 05:04 PM
  4. SOAP set_entry errors
    By ibutler in forum Developer Help
    Replies: 0
    Last Post: 2007-07-11, 08:33 PM
  5. SOAP API set_entry
    By Shearer in forum Help
    Replies: 1
    Last Post: 2006-12-18, 05:08 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
  •