用SoapUI测试SugarCRM 6.5 社区版的SOAP Web Services

时间:2021-03-14 07:18:02

SugarCRM 6.5.10 社区版安装后,SOAP Web Services开箱即用。


sugarcrm SOAP URL:
http://127.0.0.1/sugarcrm//service/v4/soap.php?wsdl


注意password需要是MD5编码过的! 找个在线MD5 Encoder编码下即可。


SOAP请求:

<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:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<user_auth xsi:type="sug:user_auth">
<!--You may enter the following 2 items in any order-->
<user_name xsi:type="xsd:string">admin</user_name>
<password xsi:type="xsd:string">21232f297a57a5a743894a0e4a801fc3</password>
</user_auth>
<application_name xsi:type="xsd:string">test</application_name>
<name_value_list xsi:type="sug:name_value_list" soapenc:arrayType="sug:name_value[]"/>
</sug:login>
</soapenv:Body>
</soapenv:Envelope>

返回结果:

<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:loginResponse xmlns:ns1="http://www.sugarcrm.com/sugarcrm">         <return xsi:type="tns:entry_value">            <id xsi:type="xsd:string">hrt4jic1h53gog5mjd5jfvk043</id>            <module_name xsi:type="xsd:string">Users</module_name>            <name_value_list xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:name_value[13]">               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_id</name>                  <value xsi:type="xsd:string">1</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_name</name>                  <value xsi:type="xsd:string">admin</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_language</name>                  <value xsi:type="xsd:string">en_us</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_currency_id</name>                  <value xsi:type="xsd:string"/>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_is_admin</name>                  <value xsi:type="xsd:string">1</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_default_team_id</name>                  <value xsi:nil="true" xsi:type="xsd:string"/>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_default_dateformat</name>                  <value xsi:type="xsd:string">m/d/Y</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_default_timeformat</name>                  <value xsi:type="xsd:string">H:i</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_number_seperator</name>                  <value xsi:type="xsd:string">,</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_decimal_seperator</name>                  <value xsi:type="xsd:string">.</value>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">mobile_max_list_entries</name>                  <value xsi:nil="true" xsi:type="xsd:string"/>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">mobile_max_subpanel_entries</name>                  <value xsi:nil="true" xsi:type="xsd:string"/>               </item>               <item xsi:type="tns:name_value">                  <name xsi:type="xsd:string">user_currency_name</name>                  <value xsi:type="xsd:string">US Dollars</value>               </item>            </name_value_list>         </return>      </ns1:loginResponse>   </SOAP-ENV:Body></SOAP-ENV:Envelope>


参考:

http://nchc.dl.sourceforge.net/project/sugarcrm/1%20-%20SugarCRM%206.5.X/FastStack/
下载:sugarcrm-CE-6.5.10-windows-installer.exe
安装说明:
大概意思是说这几个部件会自动安装好!
Apache 2.2.2.21
PHP 5.3.8
MySQL 5.5.16
phpmyadmin 3.4.8

SugarCRM的SOAP接口文档 - webdevessential
http://webdevessential.googlecode.com/svn/trunk/note/php/sugar/SugarCRM%20SOAP%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3.doc

How To: Retrieve a User ID via SOAP in SugarCRM
http://kovshenin.com/2010/retrieve-user-id-soap-sugarcrm/

A PHP example demonstrating how to log in and retrieve a session key using NuSOAP and the v4 SOAP API.
http://support.sugarcrm.com/04_Find_Answers/03_Developers/100Web_Services/100Soap_API/100Examples/100PHP/Logging_In_-_SOAP_and_PHP/

sugarcrm soap call
http://dl.sugarforge.org/ws-testing/SOAPSonarforSugarCRM/GettingStarted/soapsonar_sugarcrm_getting_started.pdf