{"id":68,"date":"2016-05-06T11:26:35","date_gmt":"2016-05-06T11:26:35","guid":{"rendered":"http:\/\/symbioticindia.in\/docu\/?p=68"},"modified":"2016-05-06T14:32:55","modified_gmt":"2016-05-06T14:32:55","slug":"soap-connectivity-to-sugarcrm-php-code","status":"publish","type":"post","link":"http:\/\/symbioticindia.in\/docu\/2016\/05\/06\/soap-connectivity-to-sugarcrm-php-code\/","title":{"rendered":"SOAP Connectivity to Sugarcrm PHP Code"},"content":{"rendered":"<p>&lt;?php<br \/>\n$client = new SoapClient(&#8220;http:\/\/192.168.1.27\/soap.php?wsdl&#8221;, array(&#8220;trace&#8221; =&gt; 1, &#8220;exception&#8221; =&gt; 0));<\/p>\n<p>\/\/ LOGIN<br \/>\n$response = $client-&gt;__soapCall(&#8220;login&#8221;,<br \/>\narray(<br \/>\n&#8220;user_auth&#8221; =&gt;<br \/>\narray(<br \/>\n&#8216;user_name&#8217; =&gt; &#8216;user&#8217;,<br \/>\n&#8216;password&#8217; =&gt; md5(&#8216;bitnami&#8217;),<br \/>\n&#8216;version&#8217; =&gt; &#8220;0.1&#8221;<br \/>\n),<br \/>\n&#8220;application_name&#8221; =&gt; &#8221;<br \/>\n)<br \/>\n);<br \/>\n$session_id = $response-&gt;id;<br \/>\necho &#8220;session_id=$session_id\\n&#8221;;<\/p>\n<p>\/\/ CREATE ACCOUNT<br \/>\n$response = $client-&gt;set_entry($session_id, &#8216;Accounts&#8217;, array(<br \/>\narray(&#8216;name&#8217; =&gt; &#8216;name&#8217;, &#8216;value&#8217; =&gt; &#8220;Account Test 003&#8221;),<br \/>\narray(&#8216;name&#8217; =&gt; &#8216;phone&#8217;, &#8216;value&#8217; =&gt; &#8220;0102031003&#8221;)<br \/>\n));<br \/>\n$account_id = $response-&gt;id;<br \/>\necho &#8220;account_id=$account_id\\n&#8221;;<\/p>\n<p>\/\/The &#8220;trace&#8221; parameter when creating the SoapClient instance let you play with the PHP Soap debug trace. Try to add these lines at the end of the code:<br \/>\necho &#8220;LastRequest\\n&#8221;;<br \/>\necho $client-&gt;__getLastRequest();<br \/>\necho &#8220;LastResponse\\n&#8221;;<br \/>\necho $client-&gt;__getLastResponse();<br \/>\n?&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>refined as per custom module<\/p>\n<p>&lt;?php<br \/>\n$client = new SoapClient(&#8220;http:\/\/192.168.1.27\/soap.php?wsdl&#8221;, array(&#8220;trace&#8221; =&gt; 1, &#8220;exception&#8221; =&gt; 0));<\/p>\n<p>\/\/ LOGIN<br \/>\n$response = $client-&gt;__soapCall(&#8220;login&#8221;,<br \/>\narray(<br \/>\n&#8220;user_auth&#8221; =&gt;<br \/>\narray(<br \/>\n&#8216;user_name&#8217; =&gt; &#8216;user&#8217;,<br \/>\n&#8216;password&#8217; =&gt; md5(&#8216;bitnami&#8217;),<br \/>\n&#8216;version&#8217; =&gt; &#8220;0.1&#8221;<br \/>\n),<br \/>\n&#8220;application_name&#8221; =&gt; &#8221;<br \/>\n)<br \/>\n);<br \/>\n$session_id = $response-&gt;id;<br \/>\necho &#8220;session_id=$session_id\\n&#8221;;<\/p>\n<p>\/\/ CREATE entry<br \/>\n\/\/ sym03_soaptest is like &lt;key&gt;_&lt;modulename&gt;<\/p>\n<p>$response = $client-&gt;set_entry($session_id, &#8216;sym03_soaptest&#8217;, array(<br \/>\n\/\/ array(&#8216;name&#8217; =&gt; &#8216;name&#8217;, &#8216;value&#8217; =&gt; &#8220;005&#8221;),<br \/>\narray(&#8216;name&#8217; =&gt; &#8216;name&#8217;, &#8216;value&#8217; =&gt; &#8220;Sultan&#8221;),<br \/>\narray(&#8216;name&#8217; =&gt; &#8216;description&#8217;, &#8216;value&#8217; =&gt; &#8220;description 001&#8221;)<\/p>\n<p>));<br \/>\n$soapid = $response-&gt;id;<br \/>\necho &#8220;soapid=$soapid\\n&#8221;;<\/p>\n<p>\/\/The &#8220;trace&#8221; parameter when creating the SoapClient instance let you play with the PHP Soap debug trace. Try to add these lines at the end of the code:<br \/>\necho &#8220;LastRequest\\n&#8221;;<br \/>\necho $client-&gt;__getLastRequest();<br \/>\necho &#8220;LastResponse\\n&#8221;;<br \/>\necho $client-&gt;__getLastResponse();<br \/>\n?&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php $client = new SoapClient(&#8220;http:\/\/192.168.1.27\/soap.php?wsdl&#8221;, array(&#8220;trace&#8221; =&gt; 1, &#8220;exception&#8221; =&gt; 0)); \/\/ LOGIN $response = $client-&gt;__soapCall(&#8220;login&#8221;, array( &#8220;user_auth&#8221; =&gt; array( &#8216;user_name&#8217; =&gt; &#8216;user&#8217;, &#8216;password&#8217; =&gt; md5(&#8216;bitnami&#8217;), &#8216;version&#8217; =&gt; &#8220;0.1&#8221; ), &#8220;application_name&#8221; =&gt; &#8221; ) ); $session_id = $response-&gt;id; echo &#8220;session_id=$session_id\\n&#8221;; \/\/ CREATE ACCOUNT $response = $client-&gt;set_entry($session_id, &#8216;Accounts&#8217;, array( array(&#8216;name&#8217; =&gt; &#8216;name&#8217;, &#8216;value&#8217; =&gt; &#8220;Account Test ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"http:\/\/symbioticindia.in\/docu\/2016\/05\/06\/soap-connectivity-to-sugarcrm-php-code\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,2],"tags":[],"class_list":["post-68","post","type-post","status-publish","format-standard","hentry","category-php","category-sugarcrm"],"_links":{"self":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/68","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":2,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":73,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/68\/revisions\/73"}],"wp:attachment":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}