SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  

Building	
  a	
  client	
  .NET	
  for	
  SugarCRM	
  
         During	
   this	
   article	
   we	
   will	
   see	
   how	
   to	
   make	
   a	
   .NET	
   client	
   to	
   access	
   the	
  
information	
  recorded	
  on	
  the	
  CRM	
  system	
  and	
  use	
  the	
  client	
  as	
  the	
  basis	
  for	
  the	
  
realization	
   of	
   a	
   simple	
   application	
   .NET	
   C#	
   that	
   is	
   able	
   to	
   perform	
   a	
   series	
   of	
  
elementary	
  operations	
  as:	
  login,	
  create	
  a	
  new	
  contact	
  and	
  retrieve	
  data.	
  
         SugarCRM (SugarCRM Inc.)	
   exports	
   to	
   the	
   outside	
   of	
   the	
   interfaces	
   that	
  
support	
   SOAP	
   and	
   REST	
   protocols,	
   through	
   these	
   interfaces	
   provide	
   access	
   to	
  
data	
   through	
   a	
   set	
   of	
   CRUD	
   operations	
   (SugarCRM Inc.).	
   The	
   version	
   of	
  
SugarCRM,	
  which	
  we	
  will	
  use,	
  is	
  the	
  6.1	
  Community	
  Edition	
  (SugarCRM Inc.).	
  
         We	
  use	
  the	
  SOAP	
  protocol	
  for	
  interaction	
  between	
  our	
  application	
  .NET	
  and	
  
SugarCRM.	
  There	
  are	
  different	
  ways	
  to	
  create	
  a	
  C#	
  SOAP	
  client	
  can	
  communicate	
  
with	
  a	
  web	
  service	
  using	
  .NET	
  Framework	
  (Microsoft)	
  (Wikipedia).	
  
	
  
The	
  steps	
  to	
  follow	
  to	
  reach	
  our	
  goal	
  are:	
  
       • Generating	
  the	
  SOAP	
  client	
  
       • Compiling	
  a	
  SOAP	
  client,	
  such	
  as	
  .NET	
  Library	
  Assembly	
  
       • Create	
  the	
  application	
  .NET	
  C#	
  
	
  
The	
  tools	
  we	
  use	
  to	
  complete	
  the	
  work	
  are:	
  
        • .NET	
   Framework	
   SDK:	
   Runtime	
   and	
   development	
   tools.	
   The	
   reference	
  
              version	
   used	
   in	
   this	
   article,	
   is	
   4.0	
   of	
   the	
   framework.	
   The	
   Web	
   services	
  
              support	
   is	
   however	
   also	
   supported	
   by	
   previous	
   versions	
   of	
   the	
  
              framework.	
  	
  	
  
        • SharpDevelop:	
   Open	
   Source	
   Development	
   Environment	
   for	
   .NET.	
   The	
  
              reference	
  version	
  used	
  in	
  this	
  article,	
  is	
  4.1 (IC#Code)	
  
	
  
         The	
   article	
   is	
   intended	
   for	
   an	
   audience	
   that	
   has	
   the	
   basic	
   knowledge	
   of	
  
software	
   development	
   .NET	
   platform	
   and	
   in	
   particular	
   by	
   using	
   the	
   C#	
   language,	
  
as	
  well	
  as	
  having	
  some	
  familiarity	
  with	
  the	
  technology	
  of	
  web	
  services.	
  
         	
  
         The	
   entire	
   project	
   source	
   code	
   made	
   in	
   the	
   article	
   is	
   available	
   on	
   GitHub	
  
repository	
  at:	
  
	
  https://github.com/amusarra/SugarCRM_CE_SOAP_V21_DotNetClientLibrary	
  	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  




14/11/11	
                                                                                                                                             1	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                          	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                            Blog:	
  http://musarra.wordpress.com	
  
                                                                                                             Mail:	
  antonio.musarra@gmail.com	
  
	
  
         1. The	
  creation	
  of	
  SOAP	
  Client	
  
           To	
  communicate	
  with	
  the	
  SugarCRM	
  web	
  service	
  you	
  must	
  create	
  a	
  proxy	
  
class,	
  a	
  software	
  element	
  that	
  allows	
  us	
  to	
  transparently	
  access	
  the	
  web	
  service	
  
without	
   worrying	
   about	
   the	
   way	
   this	
   is	
   called	
   and	
   used.	
   The	
   Proxy	
   class	
   is	
  
derived	
   directly	
   from	
   the	
   WSDL	
   document	
   that	
   describes	
   the	
   web	
   service.	
  
SugarCRM,	
  version	
  5.5,	
  introduced	
  support	
  for	
  versioning	
  to	
  its	
  API	
  exposed	
  as	
  
REST	
   web	
   service	
   is	
   SOAP,	
   the	
   version	
   of	
   the	
   API	
   reference	
   is	
   2.1 (SugarCRM
Inc.).	
  
           Through	
  the	
  SharpDevelop	
  IDE,	
  using	
  the	
  Add	
  Web	
  Reference	
  feature,	
  the	
  
creation	
   of	
   the	
   proxy	
   class	
   is	
   fairly	
   straightforward.	
   The	
   creation	
   of	
   the	
   proxy	
  
class	
  is	
   an	
   operation	
   that	
   can	
   also	
   be	
   performed	
   using	
   the	
   SDK	
   tools	
   .NET,	
  in	
   Box	
  
2	
  shows	
  how	
  to	
  create	
  and	
  build.	
  
           Following	
  a	
  brief	
  summary	
  of	
  the	
  tasks	
  that	
  must	
  run	
  on	
  SharpDevelop	
  to	
  
create	
  our	
  assembly	
  that	
  will	
  be	
  used	
  by	
  the	
  application	
  .NET	
  C#	
  to	
  communicate	
  
with	
  SugarCRM:	
  
	
  
       • Creating	
  a	
  new	
  Project	
  /	
  Solution	
  
       • Creating	
  the	
  Proxy	
  Class	
  through	
  the	
  Add	
  Web	
  Reference	
  
       • Building	
  the	
  Project	
  
	
  
           The	
   process	
   of	
   creating	
   the	
   proxy	
   class	
   requires	
   the	
   WSDL	
   of	
   the	
   web	
  
service	
   of	
   SugarCRM,	
   the	
   WSDL	
   can	
   be	
   remote	
   (http	
   /	
   s)	
   or	
   local	
   (file	
   system).	
   In	
  
our	
  case	
  we	
  will	
  use	
  an	
  instance	
  of	
  SugarCRM	
  installed	
  on	
  the	
  platform	
  PHPFog	
  
(PHPFog)	
   and	
   can	
   be	
   reached	
   at	
   https://shirus-­‐crm.phpfogapp.com.	
   The	
   figures	
  
shown	
   to	
   follow	
   illustrate	
   some	
   of	
   the	
   important	
   phases	
   in	
   of	
   the	
   process	
   of	
  
creating	
  the	
  project	
  of	
  SharpDevelop.	
  
	
  




                                                                                                                                       	
  
	
  	
  	
  	
  Figure	
  1	
  The	
  creation	
  of	
  new	
  project	
  as	
  a	
  Class	
  Library.	
  

             	
  

14/11/11	
                                                                                                                                               2	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                            	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
      The	
   new	
   project	
   must	
   be	
   created	
   using	
   the	
   Class	
   Library	
   template	
   and	
  
specifying	
   the	
   profile	
   .NET	
   appropriate	
   (in	
   our	
   case	
   .NET	
   Client	
   Profile	
   4).	
   The	
  
project	
  will	
  be	
  created	
  within	
  a	
  solution	
  that	
  will	
  take	
  the	
  name	
  specified	
  in	
  the	
  
Solution	
  Name	
  (see	
  Figure	
  1).	
  
      	
  
      	
  




                                                                                                                        	
  
Figure	
  2	
  Access	
  to	
  the	
  function	
  of	
  Add	
  Web	
  Reference.	
  

          Once	
  the	
  project	
  is	
  created	
  you	
  can	
  proceed	
  with	
  the	
  creation	
  of	
  the	
  proxy	
  
class	
   using	
   the	
   Add	
   Web	
   Reference	
   accessible	
   through	
   the	
   context	
   menu	
   of	
   the	
  
project.	
  
          	
  
          	
  	
  




                                                                                                                                    	
  
	
  Figure	
  3	
  Add	
  Web	
  Reference:	
  SugarCRM	
  web	
  service's	
  WSDL.	
  

         The	
   WSDL	
   document	
   that	
   describes	
   the	
   web	
   service	
   is	
   accessible	
   at	
  
https://shirus-­‐crm.phpfogapp.com/service/v2_1/soap.php?wsdl.	
   For	
   reasons	
   of	
  
simplicity	
  I	
  decided	
  to	
  simplify	
  the	
  Reference	
  Name	
  and	
  Namespace	
  than	
  those	
  
proposed	
   by	
   default	
   (see	
   Figure	
   3).	
   Once	
   downloaded	
   you	
   can	
   view	
   the	
   WSDL	
  
operations	
  exposed	
  by	
  the	
  web	
  service	
  through	
  the	
  tab	
  "Available	
  Web	
  Services"	
  
(see	
  Figure	
  4).	
  	
  
         	
  
14/11/11	
                                                                                                              3	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                       	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  




                                                                                                                                           	
  
	
  Figure	
  4	
  Operations	
  exposed	
  by	
  the	
  web	
  service.	
  

	
  




                                                                                                                                    	
  
Figure	
  5	
  View	
  of	
  the	
  project	
  after	
  the	
  operation	
  Add	
  Web	
  Reference.	
  

      Figure	
  5	
  shows	
  the	
  result	
  obtained	
  as	
  the	
  result	
  of	
  the	
  Web	
  Reference.	
  The	
  
Reference.cs	
   file,	
   contains	
   our	
   Proxy	
   Class.	
   To	
   complete	
   this	
   first	
   phase	
   it	
   only	
  
remains	
   to	
   complete	
   the	
   project,	
   the	
   build	
   process	
   will	
   create	
   within	
   the	
   bin	
  
directory,	
  the	
  dll	
  assembly.	
  
	
  
	
  
	
  
	
  
	
  




14/11/11	
                                                                                                                                             4	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                          	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
         2. The	
  creation	
  of	
  the	
  .NET	
  C#	
  Application	
  
         Inside	
  the	
  solution	
  created	
  for	
  the	
  project	
  of	
  the	
  Proxy	
  class,	
  we	
   add	
  a	
  new	
  
C#	
   project	
   which	
   we	
   will	
   call,	
   for	
   example,	
   SugarCRM_SOAP_Console_Client,	
  
using	
  the	
  template	
  Windows	
  Console	
  (Windows	
  Applications	
  category).	
  
         Before	
   proceeding	
   further,	
   we	
   add	
   the	
   new	
   project,	
   a	
   reference	
   to	
  
System.Web.Services	
   and	
   SugarCRM_CE_SOAP_V21_ClientLibrary	
   libraries.	
   The	
  
reference	
   to	
   the	
   libraries	
   must	
   be	
   added	
   using	
   the	
   Add	
   Reference	
   from	
   the	
  
context	
  menu	
  of	
  the	
  project	
  (see	
  Figure	
  6	
  and	
  Figure	
  7).	
  
         	
  
The	
  sample	
  application	
  we	
  are	
  building	
  must	
  meet	
  the	
  following	
  flow:	
  
	
  
       a) Log	
  in	
  to	
  the	
  specified	
  user;	
  
       b) Read	
  some	
  information	
  about	
  the	
  system;	
  
       c) Reading	
  for	
  information	
  about	
  who	
  is	
  logged	
  in;	
  
       d) Inserting	
  a	
  new	
  contact;	
  
       e) Reading	
  data	
  from	
  the	
  contact	
  listed	
  above;	
  
       f) User	
  logout.	
  
	
  
         Let	
  us	
  describe	
  briefly	
  what	
  the	
  Web	
  service	
  operations	
  that	
  we	
  must	
  use	
  
in	
  order	
  to	
  realize	
  the	
  specified	
  flow	
  and	
  ways	
  of	
  using	
  the	
  application	
  itself.	
  In	
  
Table	
   1	
   are	
   shown	
   in	
   order	
   of	
   the	
   operations	
   that	
   use.	
   For	
   more	
   information	
  
about	
  SugarCRM	
  API	
  should	
  consult	
  the	
  documentation.	
  
	
  




                                                                                                                                      	
  
Figure	
  6	
  Add	
  Reference.	
  

	
  




14/11/11	
                                                                                                                                             5	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                          	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  




                                                                                                                                    	
  
Figure	
  7	
  List	
  of	
  references.	
  	
  

	
  
Order	
   Operations	
        Description	
  
1	
       get_server_info	
   Returns	
   a	
   set	
   of	
   very	
   useful	
   information	
   to	
   identify	
   the	
  
                              details	
   of	
   installing	
   SugarCRM	
   (example:	
   version,	
  
                              edition,	
  etc	
  ...).	
  
2	
       login	
             Perform	
   the	
   login	
   process	
   for	
   the	
   user	
   specified,	
  
                              returns	
  the	
  session	
  identifier	
  (SessionID).	
  The	
  value	
  of	
  
                              the	
  SessionID	
  is	
  used	
  in	
  all	
  operations	
  that	
  require	
  the	
  
                              identification	
  of	
  the	
  current	
  user.	
  
3	
       get_user_id	
       Returns	
   the	
   ID	
   of	
   the	
   user	
   specifying	
   the	
   current	
  
                              session.	
  
4	
       set_entry	
         Insert	
  an	
  item	
  for	
  the	
  specified	
  module,	
  for	
  example,	
  a	
  
                              contact,	
  leads,	
  accounts,	
  etc	
  ...	
  
5	
       get_entry	
         Returns	
  an	
  object	
  that	
  refers	
  to	
  the	
  specified	
  module.	
  
6	
       logout	
            Current	
  user	
  logs	
  out.	
  
Table	
  1	
  List	
  of	
  Web	
  service	
  operations	
  used	
  by	
  the	
  application.	
  

Our	
   application	
   (like	
   Windows	
   Console)	
   will	
   accept	
   as	
   input	
   a	
   username	
   and	
  
password,	
  plus	
  the	
  address	
  (URL)	
  you	
  wish	
  to	
  connect	
  SugarCRM	
  instance.	
  
	
  
Usage: SugarCRMClient.exe {username} {password} [SugarCRM URL]

Listing	
  1	
  Using	
  the	
  client	
  SugarCRM	
  via	
  console.	
  

      The	
   use	
   of	
   the	
   client	
   does	
   not	
   necessarily	
   require	
   you	
   to	
   specify	
   the	
   URL	
   of	
  
SugarCRM,	
   if	
   not	
   specified,	
   will	
   use	
   the	
   URL	
   from	
   which	
   you	
   created	
   the	
   SOAP	
  
client	
   (Proxy	
   Class).	
   Listing	
   1	
   shows	
   how	
   to	
   use	
   the	
   command-­‐line	
   client	
   and	
  
Listing	
  2	
  shows	
  an	
  example	
  of	
  use.	
  
      	
  
      	
  
SugarCRMClient.exe amusarra amusarra https://shirus-crm.phpfogapps.com

Listing	
  2	
  Example	
  of	
  client	
  usage.	
  


14/11/11	
                                                                                                                                             6	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                          	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
        The	
  URL	
  must	
  not	
  be	
  to	
  the	
  WSDL	
  document	
  but	
  rather	
  address	
  the	
  root	
  of	
  
SugarCRM,	
   the	
   application	
   will	
   then	
   be	
   responsible	
   to	
   construct	
   the	
   full	
   URL	
   of	
  
the	
  API.	
  The	
  output	
  of	
  the	
  application	
  will	
  be	
  displayed	
  on	
  the	
  console.	
  
        Summarily	
  we	
  have	
  defined	
  the	
  functions	
  required	
  and	
  how	
  the	
  application	
  
should	
   be	
   used,	
   at	
   this	
   point	
   we	
   briefly	
   analyze	
   the	
   code	
   of	
   our	
   application.	
   Code	
  
blocks	
  are	
  shown	
  to	
  follow	
  the	
  flow	
  in	
  the	
  order	
  indicated	
  above.	
  	
  
	
  
	
  
// Create a new instance of SugarCRM SOAP Proxy Client
shirus.crm.phpfogapp.com.sugarsoap client = new shirus.crm.phpfogapp.com.sugarsoap();

if (SugarCRM_URL != null) {
       client.Url = SugarCRM_URL.AbsoluteUri + "service/v2_1/soap.php";
}

/**
 * Step 1) Try login to SugarCRM istance with username and password
 */

// Prepare a User Auth Object
shirus.crm.phpfogapp.com.user_auth userAuthInfo = new
shirus.crm.phpfogapp.com.user_auth();

userAuthInfo.user_name = sugarCRMUserName;
userAuthInfo.password = GetMD5Hash(sugarCRMPassword,false);

// Execute a login as admin
shirus.crm.phpfogapp.com.entry_value userSession = client.login(userAuthInfo,
"SugarCRM Console Client 1.0.0", null);
	
  
Listing	
  3	
  Login	
  operation.	
  

	
  
/**
 * Step 2) Get SugarCRM Server Info
 */
Console.WriteLine("SugarCRM EndPoint URL: " + client.Url);
Console.WriteLine("SugarCRM Server Version: " + client.get_server_info().version);
Console.WriteLine("SugarCRM Server Edition: " + client.get_server_info().flavor);
Console.WriteLine("SugarCRM Server Time: " + client.get_server_info().gmt_time);

/**
 * Step 3) Get logged user info
 */
String userId = client.get_user_id(userSession.id);

Console.WriteLine("Welcome Your SessionID: " + userSession.id);
Console.WriteLine("Get user data...");
Console.WriteLine("---------- BEGIN USER DATA ----------");

shirus.crm.phpfogapp.com.get_entry_result_version2 userInfo =
client.get_entry(userSession.id, userSession.module_name, userId, null, null);

foreach (shirus.crm.phpfogapp.com.name_value nameValue in
userInfo.entry_list[0].name_value_list) {
        if (nameValue.value.Length > 0 && nameValue.name != "user_hash") {
               Console.WriteLine(nameValue.name + ": " + nameValue.value);
        }

14/11/11	
                                                                                                                                             7	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                          	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
}

Console.WriteLine("---------- END USER DATA ----------");
	
  
Listing	
  4	
  SugarCRM	
  and	
  server	
  information	
  when	
  the	
  user	
  logged.	
  

	
  
/**
 * Step 4) Insert new contact
 */
Console.WriteLine("Try insert new Contact...");

Dictionary<string, string> contactsData = new Dictionary<string, string>();
contactsData.Add("first_name", "Antonio");
contactsData.Add("last_name","Musarra");
contactsData.Add("title", "IT Senior Consultant");
contactsData.Add("description", "Contacts created bye .NET SOAP Client");
contactsData.Add("email1","antonio.musarra@gmail.com");

shirus.crm.phpfogapp.com.name_value[] name_value_list = new
shirus.crm.phpfogapp.com.name_value[contactsData.Count];

int i = 0;
foreach (KeyValuePair<string, string> kvp in contactsData) {
        name_value_list[i] = new shirus.crm.phpfogapp.com.name_value();
        name_value_list[i].name = kvp.Key;
        name_value_list[i].value = kvp.Value;
        i++;
}

shirus.crm.phpfogapp.com.new_set_entry_result contactResult =
client.set_entry(userSession.id, "Contacts", name_value_list);
Console.WriteLine("New Contact as Id:" + contactResult.id);
	
  
Listing	
  5	
  Inserting	
  a	
  new	
  contact.	
  

	
  
/**
 * Step 5) Get My Contacts
 */
Console.WriteLine("Get data for Contacts: " + contactResult.id);
Console.WriteLine("---------- BEGIN CONTACTS DATA ----------");
shirus.crm.phpfogapp.com.get_entry_result_version2 myContacts =
client.get_entry(userSession.id, "Contacts", contactResult.id, null, null);

foreach (shirus.crm.phpfogapp.com.name_value nameValue in
myContacts.entry_list[0].name_value_list) {
        if (nameValue.value.Length > 0) {
               Console.WriteLine(nameValue.name + ": " + nameValue.value);
        }
}
Console.WriteLine("---------- END CONTACTS DATA ----------");

/**
 * Step 6) Logout
 */
client.logout(userSession.id);
Console.WriteLine("User disconnected");
	
  
14/11/11	
                                                                                                                                             8	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                          	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
Listing	
  6	
  Retrieving	
  contact	
  data,	
  and	
  user	
  logout.	
  

	
  
      I	
   remember	
   that	
   the	
   entire	
   project	
   is	
   available	
   on	
   the	
   public	
   repository	
  
GitHub	
  
https://github.com/amusarra/SugarCRM_CE_SOAP_V21_DotNetClientLibrary	
  	
  
	
  
	
  




                                                                                                                                                                 	
  
Figure	
  8	
  Running	
  the	
  client	
  SugarCRMClient	
  [0].	
  

	
  




                                                                                                                                                                 	
  
Figure	
  9	
  Running	
  the	
  client	
  SugarCRMClient	
  [1].	
  

	
  
	
  
	
  


14/11/11	
                                                                                                                                             9	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                          	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
Appendices	
  
	
  
SugarCRM	
  on	
  PHPFog	
  
The	
  SugarCRM	
  instance	
  to	
  which	
  we	
  referred	
  is	
  installed	
  on	
  the	
  cloud	
  platform	
  
PHPFog	
  whose	
  data	
  access	
  are	
  as	
  follows:	
  
	
  
URL:	
  https://shirus-­‐crm.phpfogapp.com	
  
User	
  Account:	
  
     • Administrator	
  =>	
  admin/admin	
  
     • User	
  =>	
  amusarra/amusarra	
  
Box	
  1	
  Login	
  information	
  for	
  the	
  SugarCRM	
  instance.	
  

	
  
The	
  creation	
  of	
  the	
  Proxy	
  Class	
  via	
  SDK	
  .NET	
  
Through	
  the	
  web	
  service's	
  WSDL	
  document,	
  we	
  can	
  create	
  the	
  proxy	
  class	
  using	
  
the	
  SDK	
  tools	
  .NET.	
  The	
  wsdl.exe	
  tool	
  allows	
  us	
  to	
  generate	
  the	
  proxy	
  class:	
  
	
  
wsdl /language:CS /v /n:shirus.crm.phpfogapp.com /o:	
  
SugarCRM_CE_SOAP_V21_ClientLibrary.cs https://shirus-
crm.phpfogapp.com/service/v2_1/soap.php?wsdl
	
  
The	
  language	
  parameter	
  allows	
  us	
  to	
  specify	
  one	
  of	
  the	
  languages	
  supported	
  by.	
  
NET	
  Framework	
  (in	
  the	
  example	
  is	
  required	
  to	
  generate	
  a	
  C	
  #	
  class).	
  The	
  result	
  
of	
  the	
  previous	
  operation	
  is	
  the	
  generation	
  
SugarCRM_CE_SOAP_V21_ClientLibrary.cs	
  file,	
  which	
  contains	
  the	
  code	
  for	
  the	
  
Proxy	
  Class	
  for	
  SugarCRM	
  SOAP	
  service.	
  
	
  
At	
  this	
  point	
  we	
  just	
  have	
  to	
  fill	
  in	
  the	
  Proxy	
  Class,	
  always	
  using	
  the	
  SDK	
  .NET:	
  
	
  
csc /t:library /out: SugarCRM_CE_SOAP_V21_ClientLibrary.dll
SugarCRM_CE_SOAP_V21_ClientLibrary.cs /r:system.dll /r:system.xml.dll
/r:system.web.services.dll
	
  
In	
  this	
  way,	
  we	
  have	
  compiled	
  the	
  class	
  as	
  a	
  class	
  library	
  (/t:	
  library)	
  indicating	
  
the	
  result	
  of	
  compiling	
  the	
  assembly	
  SugarCRM_CE_SOAP_V21_ClientLibrary.dll,	
  
and	
  using	
  the	
  metadata	
  specified	
  in	
  the	
  parameters	
  /r.	
  At	
  this	
  point	
  the	
  file	
  
SugarCRM_CE_SOAP_V21_ClientLibrary.dll,	
  can	
  be	
  used	
  as	
  a	
  library	
  from.	
  NET	
  
applications.	
  
Box	
  2	
  Creating	
  the	
  Proxy	
  Class	
  via	
  the	
  SDK.	
  NET.	
  

	
  
	
  
	
  
	
  
	
  




14/11/11	
                                                                                                                                         10	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                       	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
Bibliography	
  
Antonio	
  Musarra's	
  Blog.	
  «PHP	
  Application	
  on	
  the	
  Cloud.»	
  30	
  August	
  2011.	
  
Antonio	
  Musarra's	
  Blog.	
  Antonio	
  Musarra.	
  
<http://musarra.wordpress.com/2011/08/30/php-­‐application-­‐on-­‐the-­‐cloud/>.	
  
	
  
IBM.	
  «Best	
  practices	
  for	
  Web	
  services	
  versioning.»	
  30	
  Jan	
  2004.	
  IBM	
  
DeveloperWorks.	
  Michael	
  Ellis	
  (msellis@ca.ibm.com)	
  Kyle	
  Brown	
  
(brownkyl@us.ibm.com).	
  
<http://www.ibm.com/developerworks/webservices/library/ws-­‐version/>.	
  
	
  
IC#Code.	
  «SharpDevelop.»	
  2000.	
  SharpDevelop.	
  IC#Code.	
  
<http://sharpdevelop.net/OpenSource/SD/>.	
  
	
  
Microsoft.	
  «.NET	
  Framework.»	
  2011.	
  Microsoft	
  MSDN.	
  Microsoft.	
  
<http://msdn.microsoft.com/en-­‐en/netframework>.	
  
	
  
—.	
  «Principles	
  of	
  Service	
  Design:	
  Service	
  Versioning	
  .»	
  August	
  2005.	
  Microsoft	
  	
  
MSDN.	
  John	
  Evdemon.	
  <http://msdn.microsoft.com/en-­‐
us/library/ms954726.aspx>.	
  
	
  
PHPFog.	
  «Rock-­‐solid	
  Cloud	
  Platform	
  for	
  PHP.»	
  August	
  2010.	
  Rock-­‐solid	
  Cloud	
  
Platform	
  for	
  PHP.	
  Lucas	
  Carlson.	
  <https://www.phpfog.com/>.	
  
	
  
SOA	
  World	
  Magazine.	
  «Design	
  Strategies	
  for	
  Web	
  Services	
  Versioning.»	
  5	
  April	
  
2004.	
  SOA	
  World	
  Magazine.	
  Anjali	
  Anagol-­‐Subbarao	
  Chris	
  Peltz.	
  <http://soa.sys-­‐
con.com/node/44356>.	
  
	
  
SugarCRM	
  Inc.	
  «Sugar	
  Community	
  Edition	
  Documentation.»	
  2010.	
  Sugar	
  
Community	
  Edition	
  Documentation.	
  SugarCRM	
  Inc.	
  
<http://www.sugarcrm.com/crm/support/documentation/SugarCommunityEdi
tion/6.1/-­‐docs-­‐Developer_Guides-­‐Sugar_Developer_Guide_6.1.0-­‐
Chapter%202%20Application%20Framework.html#9000244>.	
  
	
  
—.	
  «Sugar	
  Community	
  Edition	
  Documentation.»	
  2010.	
  Sugar	
  Community	
  Edition	
  
Documentation	
  |	
  SugarCRM	
  -­‐	
  Commercial	
  Open	
  Source	
  CRM.	
  SugarCRM	
  Inc.	
  
<http://www.sugarcrm.com/crm/support/documentation/SugarCommunityEdi
tion>.	
  
	
  
—.	
  «Sugar	
  Community	
  Edition	
  Documentation	
  -­‐	
  API	
  Definition.»	
  2010.	
  Sugar	
  
Community	
  Edition	
  Documentation.	
  SugarCRM	
  Inc.	
  
<http://www.sugarcrm.com/crm/support/documentation/SugarCommunityEdi
tion/6.1/-­‐docs-­‐Developer_Guides-­‐Sugar_Developer_Guide_6.1.0-­‐
Chapter%202%20Application%20Framework.html#9000303>.	
  
	
  
—.	
  «SugarCRM	
  -­‐	
  Commercial	
  Open	
  Source	
  CRM.»	
  2004.	
  SugarCRM	
  -­‐	
  Commercial	
  
Open	
  Source	
  CRM.	
  SugarCRM	
  Inc.	
  <http://www.sugarcrm.com/crm/>.	
  

14/11/11	
                                                                                                                                         11	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                       	
  
	
  
Antonio	
  Musarra's	
  Blog	
  
The	
  ideal	
  solution	
  for	
  a	
  problem	
                                                          Blog:	
  http://musarra.wordpress.com	
  
                                                                                                           Mail:	
  antonio.musarra@gmail.com	
  
	
  
Wikipedia.	
  «.NET	
  Framework.»	
  15	
  July	
  2011.	
  Wikipedia	
  -­‐	
  The	
  Free	
  Encyclopedia.	
  
Wikipedia.	
  <http://en.wikipedia.org/wiki/.NET_Framework>.	
  
	
  
	
  




14/11/11	
                                                                                                                                         12	
  

       This	
  document	
  is	
  issued	
  with	
  license	
  Creative	
  Commons	
  Attribution-­‐NonCommercial-­‐ShareAlike	
  
                                                                                                                                                       	
  
	
  

Contenu connexe

Tendances

Easy as pie creating widgets for ibm connections
Easy as pie   creating widgets for ibm connectionsEasy as pie   creating widgets for ibm connections
Easy as pie creating widgets for ibm connectionsLetsConnect
 
Chrome Extensions for Web Hackers
Chrome Extensions for Web HackersChrome Extensions for Web Hackers
Chrome Extensions for Web HackersMark Wubben
 
servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0megrhi haikel
 
2007 2-google hacking-report
2007 2-google hacking-report2007 2-google hacking-report
2007 2-google hacking-reportsunil kumar
 

Tendances (6)

EJB 3.2 part 1
EJB 3.2 part 1EJB 3.2 part 1
EJB 3.2 part 1
 
Easy as pie creating widgets for ibm connections
Easy as pie   creating widgets for ibm connectionsEasy as pie   creating widgets for ibm connections
Easy as pie creating widgets for ibm connections
 
Dwr
DwrDwr
Dwr
 
Chrome Extensions for Web Hackers
Chrome Extensions for Web HackersChrome Extensions for Web Hackers
Chrome Extensions for Web Hackers
 
servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0
 
2007 2-google hacking-report
2007 2-google hacking-report2007 2-google hacking-report
2007 2-google hacking-report
 

Similaire à Building a Client .NET for SugarCRM

Web 2.0: characteristics and tools (2010 eng)
Web 2.0: characteristics and tools (2010 eng)Web 2.0: characteristics and tools (2010 eng)
Web 2.0: characteristics and tools (2010 eng)Carlo Vaccari
 
Flex Introduction
Flex Introduction Flex Introduction
Flex Introduction senthil0809
 
IBM Cloud UCC Talk, 22nd November 2017
IBM Cloud UCC Talk, 22nd November 2017IBM Cloud UCC Talk, 22nd November 2017
IBM Cloud UCC Talk, 22nd November 2017Michael O'Sullivan
 
Rome .NET Conference 2024 - Remote Conference
Rome .NET Conference 2024  - Remote ConferenceRome .NET Conference 2024  - Remote Conference
Rome .NET Conference 2024 - Remote ConferenceHamida Rebai Trabelsi
 
Phase 2 Case Study
Phase 2 Case StudyPhase 2 Case Study
Phase 2 Case StudyShannon Sand
 
Google chrome extension
Google chrome extensionGoogle chrome extension
Google chrome extensionJohnny Kingdom
 
Microservices and containers for the unitiated
Microservices and containers for the unitiatedMicroservices and containers for the unitiated
Microservices and containers for the unitiatedKevin Lee
 
3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdf3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdfEMERSON EDUARDO RODRIGUES
 
Lab jam websphere message broker labs
Lab jam   websphere message broker labsLab jam   websphere message broker labs
Lab jam websphere message broker labsEng Binary
 
CMS And The Evolution of Contemporary Web Design
CMS And The Evolution of Contemporary Web DesignCMS And The Evolution of Contemporary Web Design
CMS And The Evolution of Contemporary Web DesignKhamis M. Mustafa
 
Docker Announces Open Source Compose for AWS ECS & Microsoft ACI
Docker Announces Open Source Compose for AWS ECS & Microsoft ACIDocker Announces Open Source Compose for AWS ECS & Microsoft ACI
Docker Announces Open Source Compose for AWS ECS & Microsoft ACI9 series
 
XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud TIMETOACT GROUP
 
Techdays SE 2016 - Micros.. err Microcosmos
Techdays SE 2016 - Micros.. err MicrocosmosTechdays SE 2016 - Micros.. err Microcosmos
Techdays SE 2016 - Micros.. err MicrocosmosMike Martin
 

Similaire à Building a Client .NET for SugarCRM (20)

Web 2.0: characteristics and tools (2010 eng)
Web 2.0: characteristics and tools (2010 eng)Web 2.0: characteristics and tools (2010 eng)
Web 2.0: characteristics and tools (2010 eng)
 
Flex Introduction
Flex Introduction Flex Introduction
Flex Introduction
 
IBM Cloud UCC Talk, 22nd November 2017
IBM Cloud UCC Talk, 22nd November 2017IBM Cloud UCC Talk, 22nd November 2017
IBM Cloud UCC Talk, 22nd November 2017
 
Overview of Docker
Overview of DockerOverview of Docker
Overview of Docker
 
Rome .NET Conference 2024 - Remote Conference
Rome .NET Conference 2024  - Remote ConferenceRome .NET Conference 2024  - Remote Conference
Rome .NET Conference 2024 - Remote Conference
 
Demystifying Docker101
Demystifying Docker101Demystifying Docker101
Demystifying Docker101
 
Demystifying Docker
Demystifying DockerDemystifying Docker
Demystifying Docker
 
Phase 2 Case Study
Phase 2 Case StudyPhase 2 Case Study
Phase 2 Case Study
 
Google chrome extension
Google chrome extensionGoogle chrome extension
Google chrome extension
 
Microservices and containers for the unitiated
Microservices and containers for the unitiatedMicroservices and containers for the unitiated
Microservices and containers for the unitiated
 
3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdf3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdf
 
Lab jam websphere message broker labs
Lab jam   websphere message broker labsLab jam   websphere message broker labs
Lab jam websphere message broker labs
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
IBM Containers- Bluemix
IBM Containers- BluemixIBM Containers- Bluemix
IBM Containers- Bluemix
 
CMS And The Evolution of Contemporary Web Design
CMS And The Evolution of Contemporary Web DesignCMS And The Evolution of Contemporary Web Design
CMS And The Evolution of Contemporary Web Design
 
Docker Announces Open Source Compose for AWS ECS & Microsoft ACI
Docker Announces Open Source Compose for AWS ECS & Microsoft ACIDocker Announces Open Source Compose for AWS ECS & Microsoft ACI
Docker Announces Open Source Compose for AWS ECS & Microsoft ACI
 
XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud XCC Cloud for IBM Connections Cloud
XCC Cloud for IBM Connections Cloud
 
XCC 9.0 Whats New
XCC 9.0 Whats NewXCC 9.0 Whats New
XCC 9.0 Whats New
 
Os php-wiki1-pdf
Os php-wiki1-pdfOs php-wiki1-pdf
Os php-wiki1-pdf
 
Techdays SE 2016 - Micros.. err Microcosmos
Techdays SE 2016 - Micros.. err MicrocosmosTechdays SE 2016 - Micros.. err Microcosmos
Techdays SE 2016 - Micros.. err Microcosmos
 

Plus de Antonio Musarra

Liferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19cLiferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19cAntonio Musarra
 
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...Antonio Musarra
 
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19cCome installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19cAntonio Musarra
 
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...Antonio Musarra
 
Liferay & Salesforce.com
Liferay & Salesforce.comLiferay & Salesforce.com
Liferay & Salesforce.comAntonio Musarra
 
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle DatabaseCome installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle DatabaseAntonio Musarra
 
Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1Antonio Musarra
 
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleLiferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleAntonio Musarra
 
Liferay - Quick Start 1° Episodio
Liferay - Quick Start 1° EpisodioLiferay - Quick Start 1° Episodio
Liferay - Quick Start 1° EpisodioAntonio Musarra
 
SugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual ApplianceSugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual ApplianceAntonio Musarra
 
Liferay: Esporre Web Services Custom
Liferay: Esporre Web Services CustomLiferay: Esporre Web Services Custom
Liferay: Esporre Web Services CustomAntonio Musarra
 
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.Antonio Musarra
 
SugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minutiSugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minutiAntonio Musarra
 
Liferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio ExcelLiferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio ExcelAntonio Musarra
 
Introduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo EpisodioIntroduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo EpisodioAntonio Musarra
 
Introduzione a Liferay Message BUS
Introduzione a Liferay Message BUSIntroduzione a Liferay Message BUS
Introduzione a Liferay Message BUSAntonio Musarra
 
Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0Antonio Musarra
 
Running Kettle Job by API v1.2
Running Kettle Job by API v1.2Running Kettle Job by API v1.2
Running Kettle Job by API v1.2Antonio Musarra
 

Plus de Antonio Musarra (20)

Liferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19cLiferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19c
 
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
 
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19cCome installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
 
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
 
Liferay & Salesforce.com
Liferay & Salesforce.comLiferay & Salesforce.com
Liferay & Salesforce.com
 
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle DatabaseCome installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
 
Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1
 
JAX-WS e JAX-RS
JAX-WS e JAX-RSJAX-WS e JAX-RS
JAX-WS e JAX-RS
 
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleLiferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
 
OSGi e Liferay 7
OSGi e Liferay 7OSGi e Liferay 7
OSGi e Liferay 7
 
Liferay - Quick Start 1° Episodio
Liferay - Quick Start 1° EpisodioLiferay - Quick Start 1° Episodio
Liferay - Quick Start 1° Episodio
 
SugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual ApplianceSugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual Appliance
 
Liferay: Esporre Web Services Custom
Liferay: Esporre Web Services CustomLiferay: Esporre Web Services Custom
Liferay: Esporre Web Services Custom
 
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
 
SugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minutiSugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minuti
 
Liferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio ExcelLiferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio Excel
 
Introduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo EpisodioIntroduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo Episodio
 
Introduzione a Liferay Message BUS
Introduzione a Liferay Message BUSIntroduzione a Liferay Message BUS
Introduzione a Liferay Message BUS
 
Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0
 
Running Kettle Job by API v1.2
Running Kettle Job by API v1.2Running Kettle Job by API v1.2
Running Kettle Job by API v1.2
 

Dernier

UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimization100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimizationarrow10202532yuvraj
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Juan Carlos Gonzalez
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideIEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideHironori Washizaki
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Alexander Turgeon
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdfPaige Cruz
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...Daniel Zivkovic
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 

Dernier (20)

UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimization100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimization
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideIEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 

Building a Client .NET for SugarCRM

  • 1. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     Building  a  client  .NET  for  SugarCRM   During   this   article   we   will   see   how   to   make   a   .NET   client   to   access   the   information  recorded  on  the  CRM  system  and  use  the  client  as  the  basis  for  the   realization   of   a   simple   application   .NET   C#   that   is   able   to   perform   a   series   of   elementary  operations  as:  login,  create  a  new  contact  and  retrieve  data.   SugarCRM (SugarCRM Inc.)   exports   to   the   outside   of   the   interfaces   that   support   SOAP   and   REST   protocols,   through   these   interfaces   provide   access   to   data   through   a   set   of   CRUD   operations   (SugarCRM Inc.).   The   version   of   SugarCRM,  which  we  will  use,  is  the  6.1  Community  Edition  (SugarCRM Inc.).   We  use  the  SOAP  protocol  for  interaction  between  our  application  .NET  and   SugarCRM.  There  are  different  ways  to  create  a  C#  SOAP  client  can  communicate   with  a  web  service  using  .NET  Framework  (Microsoft)  (Wikipedia).     The  steps  to  follow  to  reach  our  goal  are:   • Generating  the  SOAP  client   • Compiling  a  SOAP  client,  such  as  .NET  Library  Assembly   • Create  the  application  .NET  C#     The  tools  we  use  to  complete  the  work  are:   • .NET   Framework   SDK:   Runtime   and   development   tools.   The   reference   version   used   in   this   article,   is   4.0   of   the   framework.   The   Web   services   support   is   however   also   supported   by   previous   versions   of   the   framework.       • SharpDevelop:   Open   Source   Development   Environment   for   .NET.   The   reference  version  used  in  this  article,  is  4.1 (IC#Code)     The   article   is   intended   for   an   audience   that   has   the   basic   knowledge   of   software   development   .NET   platform   and   in   particular   by   using   the   C#   language,   as  well  as  having  some  familiarity  with  the  technology  of  web  services.     The   entire   project   source   code   made   in   the   article   is   available   on   GitHub   repository  at:    https://github.com/amusarra/SugarCRM_CE_SOAP_V21_DotNetClientLibrary                     14/11/11   1   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 2. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     1. The  creation  of  SOAP  Client   To  communicate  with  the  SugarCRM  web  service  you  must  create  a  proxy   class,  a  software  element  that  allows  us  to  transparently  access  the  web  service   without   worrying   about   the   way   this   is   called   and   used.   The   Proxy   class   is   derived   directly   from   the   WSDL   document   that   describes   the   web   service.   SugarCRM,  version  5.5,  introduced  support  for  versioning  to  its  API  exposed  as   REST   web   service   is   SOAP,   the   version   of   the   API   reference   is   2.1 (SugarCRM Inc.).   Through  the  SharpDevelop  IDE,  using  the  Add  Web  Reference  feature,  the   creation   of   the   proxy   class   is   fairly   straightforward.   The   creation   of   the   proxy   class  is   an   operation   that   can   also   be   performed   using   the   SDK   tools   .NET,  in   Box   2  shows  how  to  create  and  build.   Following  a  brief  summary  of  the  tasks  that  must  run  on  SharpDevelop  to   create  our  assembly  that  will  be  used  by  the  application  .NET  C#  to  communicate   with  SugarCRM:     • Creating  a  new  Project  /  Solution   • Creating  the  Proxy  Class  through  the  Add  Web  Reference   • Building  the  Project     The   process   of   creating   the   proxy   class   requires   the   WSDL   of   the   web   service   of   SugarCRM,   the   WSDL   can   be   remote   (http   /   s)   or   local   (file   system).   In   our  case  we  will  use  an  instance  of  SugarCRM  installed  on  the  platform  PHPFog   (PHPFog)   and   can   be   reached   at   https://shirus-­‐crm.phpfogapp.com.   The   figures   shown   to   follow   illustrate   some   of   the   important   phases   in   of   the   process   of   creating  the  project  of  SharpDevelop.              Figure  1  The  creation  of  new  project  as  a  Class  Library.     14/11/11   2   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 3. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     The   new   project   must   be   created   using   the   Class   Library   template   and   specifying   the   profile   .NET   appropriate   (in   our   case   .NET   Client   Profile   4).   The   project  will  be  created  within  a  solution  that  will  take  the  name  specified  in  the   Solution  Name  (see  Figure  1).         Figure  2  Access  to  the  function  of  Add  Web  Reference.   Once  the  project  is  created  you  can  proceed  with  the  creation  of  the  proxy   class   using   the   Add   Web   Reference   accessible   through   the   context   menu   of   the   project.            Figure  3  Add  Web  Reference:  SugarCRM  web  service's  WSDL.   The   WSDL   document   that   describes   the   web   service   is   accessible   at   https://shirus-­‐crm.phpfogapp.com/service/v2_1/soap.php?wsdl.   For   reasons   of   simplicity  I  decided  to  simplify  the  Reference  Name  and  Namespace  than  those   proposed   by   default   (see   Figure   3).   Once   downloaded   you   can   view   the   WSDL   operations  exposed  by  the  web  service  through  the  tab  "Available  Web  Services"   (see  Figure  4).       14/11/11   3   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 4. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com        Figure  4  Operations  exposed  by  the  web  service.       Figure  5  View  of  the  project  after  the  operation  Add  Web  Reference.   Figure  5  shows  the  result  obtained  as  the  result  of  the  Web  Reference.  The   Reference.cs   file,   contains   our   Proxy   Class.   To   complete   this   first   phase   it   only   remains   to   complete   the   project,   the   build   process   will   create   within   the   bin   directory,  the  dll  assembly.             14/11/11   4   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 5. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     2. The  creation  of  the  .NET  C#  Application   Inside  the  solution  created  for  the  project  of  the  Proxy  class,  we   add  a  new   C#   project   which   we   will   call,   for   example,   SugarCRM_SOAP_Console_Client,   using  the  template  Windows  Console  (Windows  Applications  category).   Before   proceeding   further,   we   add   the   new   project,   a   reference   to   System.Web.Services   and   SugarCRM_CE_SOAP_V21_ClientLibrary   libraries.   The   reference   to   the   libraries   must   be   added   using   the   Add   Reference   from   the   context  menu  of  the  project  (see  Figure  6  and  Figure  7).     The  sample  application  we  are  building  must  meet  the  following  flow:     a) Log  in  to  the  specified  user;   b) Read  some  information  about  the  system;   c) Reading  for  information  about  who  is  logged  in;   d) Inserting  a  new  contact;   e) Reading  data  from  the  contact  listed  above;   f) User  logout.     Let  us  describe  briefly  what  the  Web  service  operations  that  we  must  use   in  order  to  realize  the  specified  flow  and  ways  of  using  the  application  itself.  In   Table   1   are   shown   in   order   of   the   operations   that   use.   For   more   information   about  SugarCRM  API  should  consult  the  documentation.       Figure  6  Add  Reference.     14/11/11   5   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 6. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com       Figure  7  List  of  references.       Order   Operations   Description   1   get_server_info   Returns   a   set   of   very   useful   information   to   identify   the   details   of   installing   SugarCRM   (example:   version,   edition,  etc  ...).   2   login   Perform   the   login   process   for   the   user   specified,   returns  the  session  identifier  (SessionID).  The  value  of   the  SessionID  is  used  in  all  operations  that  require  the   identification  of  the  current  user.   3   get_user_id   Returns   the   ID   of   the   user   specifying   the   current   session.   4   set_entry   Insert  an  item  for  the  specified  module,  for  example,  a   contact,  leads,  accounts,  etc  ...   5   get_entry   Returns  an  object  that  refers  to  the  specified  module.   6   logout   Current  user  logs  out.   Table  1  List  of  Web  service  operations  used  by  the  application.   Our   application   (like   Windows   Console)   will   accept   as   input   a   username   and   password,  plus  the  address  (URL)  you  wish  to  connect  SugarCRM  instance.     Usage: SugarCRMClient.exe {username} {password} [SugarCRM URL] Listing  1  Using  the  client  SugarCRM  via  console.   The   use   of   the   client   does   not   necessarily   require   you   to   specify   the   URL   of   SugarCRM,   if   not   specified,   will   use   the   URL   from   which   you   created   the   SOAP   client   (Proxy   Class).   Listing   1   shows   how   to   use   the   command-­‐line   client   and   Listing  2  shows  an  example  of  use.       SugarCRMClient.exe amusarra amusarra https://shirus-crm.phpfogapps.com Listing  2  Example  of  client  usage.   14/11/11   6   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 7. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     The  URL  must  not  be  to  the  WSDL  document  but  rather  address  the  root  of   SugarCRM,   the   application   will   then   be   responsible   to   construct   the   full   URL   of   the  API.  The  output  of  the  application  will  be  displayed  on  the  console.   Summarily  we  have  defined  the  functions  required  and  how  the  application   should   be   used,   at   this   point   we   briefly   analyze   the   code   of   our   application.   Code   blocks  are  shown  to  follow  the  flow  in  the  order  indicated  above.         // Create a new instance of SugarCRM SOAP Proxy Client shirus.crm.phpfogapp.com.sugarsoap client = new shirus.crm.phpfogapp.com.sugarsoap(); if (SugarCRM_URL != null) { client.Url = SugarCRM_URL.AbsoluteUri + "service/v2_1/soap.php"; } /** * Step 1) Try login to SugarCRM istance with username and password */ // Prepare a User Auth Object shirus.crm.phpfogapp.com.user_auth userAuthInfo = new shirus.crm.phpfogapp.com.user_auth(); userAuthInfo.user_name = sugarCRMUserName; userAuthInfo.password = GetMD5Hash(sugarCRMPassword,false); // Execute a login as admin shirus.crm.phpfogapp.com.entry_value userSession = client.login(userAuthInfo, "SugarCRM Console Client 1.0.0", null);   Listing  3  Login  operation.     /** * Step 2) Get SugarCRM Server Info */ Console.WriteLine("SugarCRM EndPoint URL: " + client.Url); Console.WriteLine("SugarCRM Server Version: " + client.get_server_info().version); Console.WriteLine("SugarCRM Server Edition: " + client.get_server_info().flavor); Console.WriteLine("SugarCRM Server Time: " + client.get_server_info().gmt_time); /** * Step 3) Get logged user info */ String userId = client.get_user_id(userSession.id); Console.WriteLine("Welcome Your SessionID: " + userSession.id); Console.WriteLine("Get user data..."); Console.WriteLine("---------- BEGIN USER DATA ----------"); shirus.crm.phpfogapp.com.get_entry_result_version2 userInfo = client.get_entry(userSession.id, userSession.module_name, userId, null, null); foreach (shirus.crm.phpfogapp.com.name_value nameValue in userInfo.entry_list[0].name_value_list) { if (nameValue.value.Length > 0 && nameValue.name != "user_hash") { Console.WriteLine(nameValue.name + ": " + nameValue.value); } 14/11/11   7   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 8. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     } Console.WriteLine("---------- END USER DATA ----------");   Listing  4  SugarCRM  and  server  information  when  the  user  logged.     /** * Step 4) Insert new contact */ Console.WriteLine("Try insert new Contact..."); Dictionary<string, string> contactsData = new Dictionary<string, string>(); contactsData.Add("first_name", "Antonio"); contactsData.Add("last_name","Musarra"); contactsData.Add("title", "IT Senior Consultant"); contactsData.Add("description", "Contacts created bye .NET SOAP Client"); contactsData.Add("email1","antonio.musarra@gmail.com"); shirus.crm.phpfogapp.com.name_value[] name_value_list = new shirus.crm.phpfogapp.com.name_value[contactsData.Count]; int i = 0; foreach (KeyValuePair<string, string> kvp in contactsData) { name_value_list[i] = new shirus.crm.phpfogapp.com.name_value(); name_value_list[i].name = kvp.Key; name_value_list[i].value = kvp.Value; i++; } shirus.crm.phpfogapp.com.new_set_entry_result contactResult = client.set_entry(userSession.id, "Contacts", name_value_list); Console.WriteLine("New Contact as Id:" + contactResult.id);   Listing  5  Inserting  a  new  contact.     /** * Step 5) Get My Contacts */ Console.WriteLine("Get data for Contacts: " + contactResult.id); Console.WriteLine("---------- BEGIN CONTACTS DATA ----------"); shirus.crm.phpfogapp.com.get_entry_result_version2 myContacts = client.get_entry(userSession.id, "Contacts", contactResult.id, null, null); foreach (shirus.crm.phpfogapp.com.name_value nameValue in myContacts.entry_list[0].name_value_list) { if (nameValue.value.Length > 0) { Console.WriteLine(nameValue.name + ": " + nameValue.value); } } Console.WriteLine("---------- END CONTACTS DATA ----------"); /** * Step 6) Logout */ client.logout(userSession.id); Console.WriteLine("User disconnected");   14/11/11   8   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 9. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     Listing  6  Retrieving  contact  data,  and  user  logout.     I   remember   that   the   entire   project   is   available   on   the   public   repository   GitHub   https://github.com/amusarra/SugarCRM_CE_SOAP_V21_DotNetClientLibrary           Figure  8  Running  the  client  SugarCRMClient  [0].       Figure  9  Running  the  client  SugarCRMClient  [1].         14/11/11   9   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 10. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     Appendices     SugarCRM  on  PHPFog   The  SugarCRM  instance  to  which  we  referred  is  installed  on  the  cloud  platform   PHPFog  whose  data  access  are  as  follows:     URL:  https://shirus-­‐crm.phpfogapp.com   User  Account:   • Administrator  =>  admin/admin   • User  =>  amusarra/amusarra   Box  1  Login  information  for  the  SugarCRM  instance.     The  creation  of  the  Proxy  Class  via  SDK  .NET   Through  the  web  service's  WSDL  document,  we  can  create  the  proxy  class  using   the  SDK  tools  .NET.  The  wsdl.exe  tool  allows  us  to  generate  the  proxy  class:     wsdl /language:CS /v /n:shirus.crm.phpfogapp.com /o:   SugarCRM_CE_SOAP_V21_ClientLibrary.cs https://shirus- crm.phpfogapp.com/service/v2_1/soap.php?wsdl   The  language  parameter  allows  us  to  specify  one  of  the  languages  supported  by.   NET  Framework  (in  the  example  is  required  to  generate  a  C  #  class).  The  result   of  the  previous  operation  is  the  generation   SugarCRM_CE_SOAP_V21_ClientLibrary.cs  file,  which  contains  the  code  for  the   Proxy  Class  for  SugarCRM  SOAP  service.     At  this  point  we  just  have  to  fill  in  the  Proxy  Class,  always  using  the  SDK  .NET:     csc /t:library /out: SugarCRM_CE_SOAP_V21_ClientLibrary.dll SugarCRM_CE_SOAP_V21_ClientLibrary.cs /r:system.dll /r:system.xml.dll /r:system.web.services.dll   In  this  way,  we  have  compiled  the  class  as  a  class  library  (/t:  library)  indicating   the  result  of  compiling  the  assembly  SugarCRM_CE_SOAP_V21_ClientLibrary.dll,   and  using  the  metadata  specified  in  the  parameters  /r.  At  this  point  the  file   SugarCRM_CE_SOAP_V21_ClientLibrary.dll,  can  be  used  as  a  library  from.  NET   applications.   Box  2  Creating  the  Proxy  Class  via  the  SDK.  NET.             14/11/11   10   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 11. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     Bibliography   Antonio  Musarra's  Blog.  «PHP  Application  on  the  Cloud.»  30  August  2011.   Antonio  Musarra's  Blog.  Antonio  Musarra.   <http://musarra.wordpress.com/2011/08/30/php-­‐application-­‐on-­‐the-­‐cloud/>.     IBM.  «Best  practices  for  Web  services  versioning.»  30  Jan  2004.  IBM   DeveloperWorks.  Michael  Ellis  (msellis@ca.ibm.com)  Kyle  Brown   (brownkyl@us.ibm.com).   <http://www.ibm.com/developerworks/webservices/library/ws-­‐version/>.     IC#Code.  «SharpDevelop.»  2000.  SharpDevelop.  IC#Code.   <http://sharpdevelop.net/OpenSource/SD/>.     Microsoft.  «.NET  Framework.»  2011.  Microsoft  MSDN.  Microsoft.   <http://msdn.microsoft.com/en-­‐en/netframework>.     —.  «Principles  of  Service  Design:  Service  Versioning  .»  August  2005.  Microsoft     MSDN.  John  Evdemon.  <http://msdn.microsoft.com/en-­‐ us/library/ms954726.aspx>.     PHPFog.  «Rock-­‐solid  Cloud  Platform  for  PHP.»  August  2010.  Rock-­‐solid  Cloud   Platform  for  PHP.  Lucas  Carlson.  <https://www.phpfog.com/>.     SOA  World  Magazine.  «Design  Strategies  for  Web  Services  Versioning.»  5  April   2004.  SOA  World  Magazine.  Anjali  Anagol-­‐Subbarao  Chris  Peltz.  <http://soa.sys-­‐ con.com/node/44356>.     SugarCRM  Inc.  «Sugar  Community  Edition  Documentation.»  2010.  Sugar   Community  Edition  Documentation.  SugarCRM  Inc.   <http://www.sugarcrm.com/crm/support/documentation/SugarCommunityEdi tion/6.1/-­‐docs-­‐Developer_Guides-­‐Sugar_Developer_Guide_6.1.0-­‐ Chapter%202%20Application%20Framework.html#9000244>.     —.  «Sugar  Community  Edition  Documentation.»  2010.  Sugar  Community  Edition   Documentation  |  SugarCRM  -­‐  Commercial  Open  Source  CRM.  SugarCRM  Inc.   <http://www.sugarcrm.com/crm/support/documentation/SugarCommunityEdi tion>.     —.  «Sugar  Community  Edition  Documentation  -­‐  API  Definition.»  2010.  Sugar   Community  Edition  Documentation.  SugarCRM  Inc.   <http://www.sugarcrm.com/crm/support/documentation/SugarCommunityEdi tion/6.1/-­‐docs-­‐Developer_Guides-­‐Sugar_Developer_Guide_6.1.0-­‐ Chapter%202%20Application%20Framework.html#9000303>.     —.  «SugarCRM  -­‐  Commercial  Open  Source  CRM.»  2004.  SugarCRM  -­‐  Commercial   Open  Source  CRM.  SugarCRM  Inc.  <http://www.sugarcrm.com/crm/>.   14/11/11   11   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike      
  • 12. Antonio  Musarra's  Blog   The  ideal  solution  for  a  problem   Blog:  http://musarra.wordpress.com   Mail:  antonio.musarra@gmail.com     Wikipedia.  «.NET  Framework.»  15  July  2011.  Wikipedia  -­‐  The  Free  Encyclopedia.   Wikipedia.  <http://en.wikipedia.org/wiki/.NET_Framework>.       14/11/11   12   This  document  is  issued  with  license  Creative  Commons  Attribution-­‐NonCommercial-­‐ShareAlike