Catalog.asmx
Company.asmx
Contact.asmx
Country.asmx
Database.asmx
FileServer.asmx
Geo.asmx
GetToken.asmx
Lead.asmx
ListManager.asmx
MailCenter.asmx
Order.asmx
Report.asmx
TCommerce.asmx
csharp // blocco di autenticazione, comune a tutti gli accessi lead.AuthHeader auth = new lead.AuthHeader(); auth.UserName = "user@domain.it"; auth.Password = "pass"; lead.TustenaLead myLead = new TustenaLead(); myLead.AuthHeaderValue = auth; //now you are autenticated //get the business object instance trough a DTO lead.LeadDTO leadDTO = new LeadDTO(); //all the properties of lead are esposed leadDTO.CompanyName = "test company"; leadDTO.Address = "somewhere"; leadDTO.EMail = "email"; leadDTO.ecc... //Save the DTO to Tustena myLead.Set(leadDTO);
csharp // cerca tutti i lead che cominciano per digita long[] ids = leadDTO.Search("CompanyName like 'digita%'"); </code> Esempio di ricerca nel modulo Database: <code lang="cs"> DbSearchStruct[] dbs = new DbSearchStruct[1]; TustenaDatabase tb = new TustenaDatabase(); tb.AuthHeaderValue = auth; // ottiene l'elenco dei database accessibili DataSet databases = tb.GetDataBases(); // accede alla struttura del singolo database DataTable dbStruct = tb.GetDatabaseStruct("Mio Database"); // inizializzo la struttura di ricerca che può essere a condizioni multiple DbSearchStruct[] dbs = new DbSearchStruct[1]; dbs[0] = new DbSearchStruct(); dbs[0].ColumnName = "Campo 1"; dbs[0].ConditionType = TypeOfSearch.Equal; dbs[0].ValueToSearch = "NO"; // recupera le righe che soddisfano la ricerca DataTable resultTable = tb.Get("Mio Database", dbs); // posso modificare la tabella a piacimento e quindi ricaricarla tb.Set("Mio Database", resultTable );
php <?php /*NuSOAP*/ require_once('NuSOAP/lib/nusoap.php'); $login ="loginname"; // Tustena login name $pass ="loginpwd"; // Tustena login password $useCURL = True; // to activate in php.ini $endpoint="http://localhost/webservice/v6/lead.asmx?wsdl"; //url of wsdl $wsdl=true; $client=new nusoap_client($endpoint, 'wsdl'); // instantiate the nusoap class $client->setCredentials($login, $pass); //submission of credentials //error handler $err = $client->getError(); if ($err) { echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; exit(); } $client->setUseCurl($useCURL); $client->useHTTPPersistentConnection(); // Prepare values of Lead. $Companyid = 1; // set the id of a lead // The exact header for the authentication $authenticationHeader = "<AuthHeader xmlns='http://www.tustena.com/webservices/'><UserName>".$login."</UserName><Password>".$pass."</Password></AuthHeader>"; // Prepare the SOAP message. $xml = '<Get xmlns="http://www.tustena.com/webservices/"><id>'.$Companyid.'</id></Get>'; //call the function to send the parameters: Get, ID Lead $result = $client->call('Get', $xml, '', '', $authenticationHeader); if ($client->fault) { // Display the fault echo '<p><b>Fault: '; print_r($result); echo '</b></p>'; } else { // Check for errors $err = $client->getError(); if ($err) { // Display the error echo '<p><b>Error: ' . $err . '</b></p>'; echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; } else { // Display the result echo "<Strong>View the result </Strong><BR>"; print_r($result); } } //function to implode multidimensional arrays function r_implode( $glue, $pieces ) { foreach( $pieces as $r_pieces ) { if( is_array( $r_pieces ) ) { $retVal[] = r_implode( $glue, $r_pieces ); } else { $retVal[] = $r_pieces; } } return implode( $glue, $retVal ); } //array to string echo "<P> <B>Array to String</B><BR>"; echo r_implode( ',', $result) . "\n"; //foreach of the array function parsearrray($array){ foreach($array as $key => $value) { if(is_array($value)) { parsearrray($value); } else { echo "<strong>".$key."</strong>" . ": " . $value ."<BR>"; } } } echo "<P> <B>Display Foreach of the array</B><BR>"; parsearrray($result); unset($client); ?>