2. SugarCRMのSOAP実装:soap.php
SugarCRMのSOAP実装:soap php
• soap.php ?
h ?
– http://host/sugarcrm/soap.php
来
• soap.php で出来ること
– 認証:login(), logout()
– 参照:get_entry(), get_entries()
参
– 更新:set_entry(), set_entries()
– 削除:set_entry(:delete = 1)
削除 t t ( d l t 1)
– その他もろもろ
• 詳しくは
– http://www.sugarcrm.com/wiki/index.php?title=SOAP_Documentation
3. soap php 使用上の注意
soap.php 使用上の注意
サ バまわりとの相性
• WEBサーバまわりとの相性
– Apache(mod_php) + soap.php → ○
– IIS(fastcgi) + soap.php → ○
– Lighttpd(fastcgi)
g p ( g) + soap.php
pp p → ×
– Other + soap.php → ?
• LDAPユーザの認証
EncryptionKey で何らかのパスワ ド暗号化が必
–E ti K で何らかのパスワード暗号化が必
要
4. NET と
.NET と SOAP
る ポ
• Visual Studioによるサポート
– 「WEB参照の追加」(Visual Studio 2005)、「サービ
参照 追加」( )、 サ
ス参照の追加」(Visual Studio 2008)によるプロキ
シクラ
シクラスの自動生成
自動 成
自動生成される
5. 実践SugarCRM SOAP API
実践SugarCRM SOAP API
統合
• ADO.NETとの統合
System.Data.SqlClient
System.Data.OracleClient
System Data OracleClient
ADO.N
System.Data.OleDb
NET
System.Data.Odbc
System.Data.SugarClient
6. どうやって動く?
• System.Data.SugarClient
Syste ata Suga C e t
string conStr =
"Data Source=http://host/sugarcrm/;User=admin;Password=foo";
using(IDbConnection con = new SugarConnection(conStr)){
con.Open();
con Open(); - A
IDbCommand cmd = con.CreateCommand();
string sql = "SELECT * FROM Contacts";
cmd.CommandText = "sql;
IDataReader reader = cmd.ExecuteReader();
while(reader.Read()){ - B
}
con.Close();
con Close();
}
SugarSoapReference.sugarsoap soap = new SugarSoapReference.sugarsoap();
SugarSoapReference.user_auth auth = new SugarSoapReference.user_auth();
auth.user_name
auth user name = user;
A auth.password = MD5(password);
var response = soap.login(auth, "SugarClient");
string _session = res.id;
B soap.get_entry_list(_session, _module, _criteria, _order, _offset, _fields, limit, 0)
t t li t( i d l it i d ff t fi ld li it 0);