-3

I developed a custom web service using Soap . The web service is supposed to send 1900+ records which satisfied the conditions in integration. When tested it only sent 1400 records and remaining are not sent. I also tested using Soap UI but couldn't figure out why the remaining records are not passed even they met the criteria.

Here is my webservice:

global with sharing class  HRDBIntegration_ws {
    WebService static list<TeamMemRecordWrapper> getTMRecords( ) 
    {
        list<TeamMemRecordWrapper> tmRecords = new list<TeamMemRecordWrapper>( );//Wrapper class for ION
        list< fHCM2__Team_Member__c > TeamMemRecords = new list< fHCM2__Team_Member__c >( );
        try
        {
            for(fHCM2__Team_Member__c tm :[select Id,fHCM2__First_Name__c,fHCM2__Surname__c,fHCM2__Middle_Name__c,fHCM2__Preferred_Name__c  ,fHCM2__Current_Employment__r.Work_Location_Code__c , fHCM2__Current_Employment__r.Work_Location_City__c, 
                                          fHCM2__Current_Employment__r.Work_Location_Country__c, fHCM2__Current_Employment__r.Work_Location_Address__c,  
                                          fHCM2__Current_Employment__r.External_Job_Title__c ,fHCM2__Current_Employment__r.Hexagon_Department__c,fHCM2__Current_Employment__r.Region__c ,fHCM2__Phone_Number__c, fHCM2__Mobile_Number__c,fHCM2__Current_Employment__r.fHCM2__Work_Location__r.Work_Location_No_Comma__c, 
                                          fHCM2__Current_Employment__r.Job_Family_View__c , fHCM2__Current_Employment__r.fHCM2__Basis__c , Notes__c , fHCM2__Email__c ,fHCM2__Federation_Id__c,fHCM2__Hire_Date__c,
                                           //fHCM2__Manager__r.fHCM2__Preferred_Name__c,fHCM2__Manager__r.fHCM2__First_Name__c ,fHCM2__Manager__r.fHCM2__Surname__c,
                                           Manager_Name_HRDB__c, fHCM2__Is_Manager__c,
                                           fHCM2__Current_Employment__r.fHCM2__End_Date__c ,fHCM2__Department__r.Name,fHCM2__Current_Employment__r.Termination_Type__c,fHCM2__Current_Employment__r.Termination_Reason__c,
                                           //fHCM2__Current_Employment__r.Voluntary_Termination_Reason__c
                                           EmailTypeRequired__c ,fHCM2__Unique_Id__c ,
                                          CreatedDate,LastModifiedDate,LastModifiedBy.Name,Comments_To_IT__c,
                                           HRDB_Integration_Status__c,Integration_Status__c,Error_Message__c from fHCM2__Team_Member__c where HRDB_Integration_Status__c = '0'  and fHCM2__Employment_Status__c!='Additional Post (Executives)' and fHCM2__Current_Employment__r.Work_Location_Code__c!=NULL  and 
                                            fHCM2__Current_Employment__r.Work_Location_City__c!= null and
                                          fHCM2__Current_Employment__r.Work_Location_Country__c!=null and 
                                           fHCM2__Current_Employment__r.Work_Location_Address__c!=null and  
                                          fHCM2__Current_Employment__r.External_Job_Title__c!= null and fHCM2__Current_Employment__r.Hexagon_Department__c !=null
                                           and fHCM2__Current_Employment__r.Region__c!=null and
                                           fHCM2__Current_Employment__r.fHCM2__Work_Location__r.Work_Location_No_Comma__c!=null and 
                                          fHCM2__Current_Employment__r.Job_Family_View__c!=null and 
                                           fHCM2__Current_Employment__r.fHCM2__Basis__c!=null  and fHCM2__Hire_Date__c!=null and

                                           Manager_Name_HRDB__c!=null and
                                           fHCM2__Department__r.Name!=null and

                                           EmailTypeRequired__c!=null  limit 500])
            {
                tm.HRDB_Integration_Status__c = '1';
                tm.Integration_Status__c = 'Pending';
                TeamMemRecords.add(tm);
            }
            if(TeamMemRecords.size()>0)
            {
               update TeamMemRecords;
            }
            for(fHCM2__Team_Member__c record:TeamMemRecords)
            {
                if(record.fHCM2__Current_Employment__r.fHCM2__End_Date__c == null ||(record.fHCM2__Current_Employment__r.fHCM2__End_Date__c!=null && record.fHCM2__Current_Employment__r.Termination_Type__c!=null && record.fHCM2__Current_Employment__r.Termination_Reason__c!=null))
                {
                    TeamMemRecordWrapper w = new TeamMemRecordWrapper();
                    w.firstName = SpecialCharsConversion.ConvertedString(record.fHCM2__First_Name__c);
                    w.lastName  = SpecialCharsConversion.ConvertedString(record.fHCM2__Surname__c);
                    w.middleName = SpecialCharsConversion.ConvertedString(record.fHCM2__Middle_Name__c);
                    //string fName = record.fHCM2__First_Name__c.to
                   String Dname = record.fHCM2__Surname__c.toUpperCase() + ' '+record.fHCM2__First_Name__c ;
                    w.displayName = record.fHCM2__Preferred_Name__c!= null && record.fHCM2__Preferred_Name__c!='' ?record.fHCM2__Surname__c.toUpperCase() + ' '+record.fHCM2__Preferred_Name__c : Dname;
                        //SpecialCharsConversion.ConvertedString(Dname);
                    w.office = record.fHCM2__Current_Employment__r.Work_Location_Code__c;
                    w.city = record.fHCM2__Current_Employment__r.Work_Location_City__c;
                    w.country = record.fHCM2__Current_Employment__r.Work_Location_Country__c;
                    w.Address = record.fHCM2__Current_Employment__r.Work_Location_Address__c;
                    //w.zipcode = record.fHCM2__Current_Employment__r.fHCM2__Work_Location__r.fHCM2__Address_Postal_Code__c;
                    w.jobTitle = record.fHCM2__Current_Employment__r.External_Job_Title__c;
                    w.department = record.fHCM2__Current_Employment__r.Hexagon_Department__c ;
                    w.region = record.fHCM2__Current_Employment__r.Region__c;
                    w.telephoneNumber = record.fHCM2__Phone_Number__c;
                    w.mobile = record.fHCM2__Mobile_Number__c ;
                    w.company = record.fHCM2__Current_Employment__r.fHCM2__Work_Location__r.Work_Location_No_Comma__c;
                    w.jobFunction = record.fHCM2__Current_Employment__r.Job_Family_View__c;
                    w.empType = record.fHCM2__Current_Employment__r.fHCM2__Basis__c;
                    w.NHCARefNo = record.Notes__c;
                    w.email = record.fHCM2__Email__c;
                    w.userPrincipalName = record.fHCM2__Federation_Id__c;
                    w.startDate = record.fHCM2__Hire_Date__c;
                    //String Mname = record.fHCM2__Manager__r.fHCM2__Surname__c .toUpperCase() + ' '+record.fHCM2__Manager__r.fHCM2__First_Name__c;
                    //String Pname = record.fHCM2__Manager__r.fHCM2__Surname__c .toUpperCase() + ' '+record.fHCM2__Manager__r.fHCM2__Preferred_Name__c ;
                    w.ManagerName = record.Manager_Name_HRDB__c;
                    w.isMgr = record.fHCM2__Is_Manager__c;
                    w.exitDate = record.fHCM2__Current_Employment__r.fHCM2__End_Date__c ;
                    w.exitType = record.fHCM2__Current_Employment__r.Termination_Type__c;
                    w.exitReason = record.fHCM2__Current_Employment__r.Termination_Reason__c;
                    //w.exitCategory = record.fHCM2__Current_Employment__r.Voluntary_Termination_Reason__c;
                    w.empStatus = (record.fHCM2__Department__r.Name=='Switzerland (Unterentfelden)' || record.fHCM2__Department__r.Name=='Switzerland (Heerbrugg)' || record.fHCM2__Department__r.Name=='Executives (Unterentfelden)') ? 'Active with out IT needs- No Integration' :record.EmailTypeRequired__c;
                    w.SageID = record.fHCM2__Unique_Id__c;
                    DateTime Cd = record.CreatedDate;
                    Date CDate = date.newinstance(Cd.year(), Cd.month(), Cd.day());
                    w.createdDate = CDate;
                    DateTime Md =  record.LastModifiedDate;
                    Date MDate = date.newinstance(Md.year(), Md.month(), Md.day());
                    w.modifiedDate = MDate;
                    w.modifiedBy = record.LastModifiedBy.Name;
                    w.Sessionid = userinfo.getSessionId();
                    w.Comments = record.Comments_To_IT__c ;
                    w.ErrorMessage = record.Error_Message__c;
                   //w.Integration Status = record.Integration_Status__c;

                   tmRecords.add(w);
                }
            }
        }
        Catch( Exception ex )
        {
            System.debug('Error:'+ex.getMessage());// Create a advanced log here
        }
        return tmRecords;
    }
    global class TeamMemRecordWrapper
    {
        //webservice string AccountId{get;set;}
        webservice string firstName{get;set;}
        webservice string lastName{get;set;}
        webservice string middleName{get;set;}
        webservice string displayName{get;set;}
        webservice string office{get;set;}
        webservice string city{get;set;}
        webservice string country{get;set;}
        webservice string Address{get;set;}
        //webservice string zipcode{get;set;}
        webservice string jobTitle{get;set;}
        webservice string department{get;set;}
        webservice string region{get;set;}
        webservice string telephoneNumber{get;set;}
        webservice string mobile{get;set;}
        webservice string company{get;set;}
        webservice string jobFunction{get;set;}
        webservice string empType{get;set;}
        webservice string NHCARefNo{get;set;}
        webservice string email{get;set;}
        webservice string userPrincipalName{get;set;}
        webservice Date startDate{get;set;}
        webservice string ManagerName{get;set;}
        webservice boolean isMgr{get;set;}
        webservice Date exitDate{get;set;}
        webservice string exitType{get;set;} 
        webservice string exitReason{get;set;}
//webservice string exitCategory{get;set;}
        webservice string empStatus{get;set;} 
        webservice string SageID{get;set;}
        webservice Date createdDate{get;set;}
        webservice Date modifiedDate{get;set;}
        webservice string modifiedBy{get;set;}
        webservice string Sessionid{get;set;}
        webservice string Comments{get;set;}
        webservice string ErrorMessage{get;set;}
    }

closed as off-topic by Pranay Jaiswal, David Reed, Reshma, battery.cord, Lukas Lunow Mar 25 at 19:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Pranay Jaiswal, David Reed, Reshma, battery.cord, Lukas Lunow
If this question can be reworded to fit the rules in the help center, please edit the question.

2

Odds are the problem is related to these lines:

Catch( Exception ex )
{
    System.debug('Error:'+ex.getMessage());// Create a advanced log here
}

Something is breaking the the webservice and the error is only being written out to the debug log. There would be no other indication in the calling service that a problem was encountered. You would just get the records successfully processed up until the point that the exception occured.

Try having that throw the exception again or examine the debug log to see what is failing.

  • Thank Daniel, Yup i am investigating using Debug Logs. But it is taking time to go through all the logs and to identify the bug. – ambitiousinme May 3 '18 at 8:47
  • @ambitiousinme Can you share the log in question? Ideally link to it from the question itself. – Daniel Ballinger May 3 '18 at 20:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.