SM-EIP service engine configuration ServiceMixion

<eip:content-based-router service="esb:simplerouter"     (Defines type
endpoint="routerEndpoint">                            of router)
<eip:rules>
<!-- # 1st routing rule -->
<eip:routing-rule>                                   (Adds routing
<eip:predicate>                                    rule)
<eip:xpath-predicate
xpath="/esb:order/esb:type=1"         (Evaluates incoming
namespaceContext="#nsContext" />       message)
<!-- if type=1-->
</eip:predicate>
<!-- forward msg to service -->
<eip:target>                                      (Targets service
<eip:exchange-target service="esb:orderService1" />
</eip:target>                                      for routing rule)
</eip:routing-rule>
<!-- # 2nd routing rule -->
<eip:routing-rule>                                   (Adds another
<eip:predicate>                                    routing rule)
<eip:xpath-predicate xpath="count(/esb:order/esb:type)=2"
namespaceContext="#nsContext" />
</eip:predicate>
<eip:target>
<eip:exchange-target
service="esb:orderService2" />
</eip:target>
</eip:routing-rule>
<!-- # 3rd routing rule -->
<eip:routing-rule>                                  (Targets service
<!-- w/o predicate ( default rule) -->
<eip:target>                                       for default rule)
<eip:exchange-target service="esb:orderService3" />
</eip:target>
</eip:routing-rule>
</eip:rules>
</eip:content-based-router>
<eip:namespace-context id="nsContext">                   (Defines namespace for
<eip:namespaces>                                       XPath expression)
<eip:namespace
prefix="esb">http://opensourceesb/architecture
</eip:namespace>
</eip:namespaces>
</eip:namespace-context>

SOAP connect to sugarCRM

original in sugarWiki

However, it’s better to create new soap client using code from palmtree here

if you wanna create contact, just change module_name from ‘Leads’ to ‘Contacts’

For instance,

<?php
define('sugarEntry', TRUE);
//Use the NuSOAP files
require_once('lib/nusoap.php');

$soapclient = new nusoap_client('http://localhost/SugarCRM/soap.php?wsdl', true);
$err = $soapclient->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

$user_auth = array(
'user_auth' => array(
'user_name' => 'admin',
'password' => md5('yourpassword'),
'version' => '0.1'
),
'application_name' => 'soapleadcapture');

$result_array = $soapclient->call('login', $user_auth);
$err = $soapclient->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

$session_id =  $result_array['id'];

$user_guid = $soapclient->call('get_user_id',$session_id);

$err = $soapclient->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

// Up until now, we have not introduced anything new
// The following lines will use the set_entry SOAP call to add
// a Lead from a mixture of POST variables and hard coded
// values, then assign to the authenticated Sugar user...
$set_entry_params = array(
'session' => $session_id,
'module_name' => 'Contacts',
'name_value_list'=>array(
array('name'=>'first_name','value'=>$_POST['first_name']),
array('name'=>'last_name','value'=>$_POST['last_name']),
array('name'=>'status', 'value'=>'New'),
array('name'=>'fos_c', 'value'=>$_POST['fos_c']),
array('name'=>'phone_work', 'value'=>$_POST['phone']),
array('name'=>'phone_fax', 'value'=>$_POST['fax']),
array('name'=>'account_name','value'=>$_POST['companyname']),
array('name'=>'lead_source','value'=>'Web Site'),
array('name'=>'description','value'=>$_POST['prod_desc']),
array('name'=>'assigned_user_id', 'value'=>$user_guid)));

$result = $soapclient->call('set_entry',$set_entry_params);

$err = $soapclient->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

// this redirects to a page specified in the previous page...
// header("Location:  " . $_POST['redirect']);

?>
<?
if ($result)
print_r($result);
?>
<form action="" method="post">
first name : <input type="text" name="first_name"/><br/>
last name : <input type="text" name="last_name"/><br/>
phone : <input type="text" name="phone"/><br/>
fax : <input type="text" name="fax"/><br/>
company name : <input type="text" name="companyname"/><br/>
product desc : <input type="text" name="prod_desc"/><br/>
Field of study : <input type="text" name="fos_c"/><br/>
<input type="submit"/>
</form>

Query data———————–

<?php
define('sugarEntry', TRUE);
//Use the NuSOAP files
require_once('lib/nusoap.php');

$soapclient = new nusoap_client('http://localhost/SugarCRM/soap.php?wsdl', true);

$user_auth = array(
'user_auth' => array(
'user_name' => 'admin',
'password' => md5('yourpassword'),
'version' => '0.1'
),
'application_name' => 'soapleadcapture');

$result_array = $soapclient->call('login', $user_auth);
$err = $soapclient->getError();
if ($err) {
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

print_r($result_array);
echo "test";

$session_id =  $result_array['id'];

$user_guid = $soapclient->call('get_user_id',$session_id);
$err = $soapclient->getError();
if ($err) {
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

// Up until now, we have not introduced anything new
// The following lines will use the set_entry SOAP call to add
// a Lead from a mixture of POST variables and hard coded
// values, then assign to the authenticated Sugar user…
$set_entry_params = array(
'session' => $session_id,
'module_name' => 'Contacts',
'query' => 'fos_c=\'CS\'',
'order_by' => 'contacts.first_name',
'offset' => 0,
'select_fields'=> array('first_name', 'phone_fax', 'fos_c'),
'max_results'=>3,
'deleted'=>0);

$result = $soapclient->call('get_entry_list',$set_entry_params);

$err = $soapclient->getError();
if ($err) {
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

// this redirects to a page specified in the previous page…
// header("Location:  " . $_POST['redirect']);

?>
<?
if ($result)
print_r($result);
?>