function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Regarding Webservice

Hi Guys,


My requirement is like this i need to get all the updates contacts on the daily basis.

I have the qurey also can anybody send me the webservice class how it look like.


My query is SELECT Id,Name,LastModifiedDate  FROM Contact  WHERE LastModifiedDate = TODAY
                                                                                                                                   AND CreatedDate != TODAY







First of all upload Partner API in the org where you need to access the code.

Here the when you click "Generate from WSDL" button (Setup-> App Setup->Develop->Apex Classes), then it generate 3 classes in your org .They are


1. faultPartnerSoapSforceCom

2. partnerSoapSforceCom

3. sobjectPartnerSoapSforceCom


Now Edit classes "sobjectPartnerSoapSforceCom" for the field that you need to access .Like add these statements to code in “sobjectPartnerSoapSforceCom” class.


public String Name;

        private String[] Name_type_info = new String[]{'Name','','string','1','1','true'};

        public String Languages;

        private String[] Languages_type_info = new String[]{'Languages__c','','string','1','1','true'};

        public String FirstName;

        private String[] FirstName_type_info = new String[]{'FirstName','','string','1','1','true'};

        public String LastName;

        private String[] LastName_type_info = new String[]{'LastName','','string','1','1','true'};

        public String Email;

        private String[] Email_type_info = new String[]{'Email','','Email','1','1','true'};

        public String LastModifiedDate  ;

        private String[] LastModifiedDate_type_info = new String[]{'LastModifiedDate','','DateTime','1','1','true'};



Now you can do query from this Partners WSDL.

Use the below code snippet as reference:


<apex:page controller="WSDLContacts" >

  <apex:form id="f1" >

 <div id="shw_con" style="display:block;" >

     <apex:outputpanel id="pp">

     <apex:pageMessages id="shwmsg"/>

         <table border="0">

         <caption><h3><font color="grey">Org 1 Contacts</font></h3></caption>

         <tr bgcolor="#d7ecf3">







         <apex:repeat value="{!wrapList}" var="k">

         <tr bgcolor="#d9dff0">
















===============================Apex Controller===============================


public class WSDLContacts {

public List<Contact> ct1{get;set;}

public class WrapperContact


         public string id{get;set;}

         public string fname{get;set;}

         public String lname{get;set;}

         public String email{get;set;}

         public String lang{get;set;}

         public String lstModDte{get;set;}      



public List<WrapperContact> wrapList{get;set;}


public WrapperContact wrpCon{get;set;}  


public WSDLContacts()





public void AccessDirectly()




         string us='';

         string ps='drr1test123';


         partnerSoapSforceCom.soap conn1= new partnerSoapSforceCom.soap();

         conn1.SessionHeader = new partnerSoapSforceCom.SessionHeader_element ();

         partnerSoapSforceCom.LoginResult loginResult1 = new partnerSoapSforceCom.LoginResult();

         partnerSoapSforceCom.LoginScopeHeader_element ls1=new partnerSoapSforceCom.LoginScopeHeader_element();


         loginResult1 =conn1.login(us,ps);

         conn1.endpoint_x =loginResult1.ServerUrl;


         conn1.Sessionheader.sessionid = loginResult1.sessionid;

         partnerSoapSforceCom.queryResult qr1 = new partnerSoapSforceCom.queryResult();

          system.debug('__________________________queryResult ____size1__________________'+qr1.size);

         qr1=conn1.query('SELECT id,Name,LastName,Email,Languages__c,LastModifiedDate  FROM Contact WHERE LastModifiedDate = TODAY AND CreatedDate != TODAY');


         wrapList=new List<WrapperContact>();



         system.debug('__________________________queryResult ____size2__________________'+qr1.size);


         for (sobjectPartnerSoapSforceCom.sObject_x obj : qr1.records)


             //   system.debug('_______________Id_________' + obj.Id+'________Name______'+obj.Name+'___Lang____'+obj.Languages);

                 wrpCon=new WrapperContact();














    catch(Exception e)








Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 


HI Navatar,


I generated partner wsdl and while trying to create apex class using 'generate wsdl' option than

it showing some error like ' unexpected token "delete" 672:51 and only two classes generated.

And i think it is like consuming wsdl in salesforce.


But what i want is salesforce apex class has to be exposed so that some datawarehousing guys can consume our wsdl.


Here I am sending my class, Please check whether it is correct or not. I have written this for getting updated contacts

on daily basis.


I want this to be expose and used by third party. Please tell me the procedure how it can be achieved and tested as well.


global class getUpdatedContact{

WebService static List<Contact> getContactInfoModifiedToday()

    List<Contact> Upcon = new List<Contact>();
    Upcon = [SELECT Id,Name,LastModifiedDate 
               FROM Contact 
               WHERE LastModifiedDate = TODAY
               AND CreatedDate != TODAY];
    return Upcon;


Where should I add the following code

        public String AcctName;
        private String[] AcctName_type_info = new String[]{'AcctName','','string','1','1','true'};
        public String ExtID;
        private String[] ExtID_type_info = new String[]{'ExtID','','string','1','1','true'};
        public String Phone;
        private String[] Phone_type_info = new String[]{'Phone','','string','1','1','true'};



Please tell me the exact class to add. i.e under partnerSoapSforceCom.soap class, where should I add.