+ Start a Discussion
sathya82sathya82 

Custom Soap Webservice Test

HI,

 

          I develop a custom soap webservice, i am using soapui tool for testing, when i use this means at that time

 only single record is inserting, may i know how can i test my program for bulk data.

Abhi_TripathiAbhi_Tripathi

Hi,

 

Go to developer Console and update records of that object on which you want to check the webservice in bulk

 

Like if you want to check on Account

 

Go to Setup --> Developer Console --> Debug --> Open Execute Anonymous Window


Write your code their something like this

 

List<Account> account = [ Select Id, Name From Account];

//Loop
for(Account acc : account) {

//Use that field for which you want to check webservice acc.Name = 'test'; } update account;

 

 

sathya82sathya82

@Abhi,

 

     global class Integration

     {

 

        global class AllObjects

       {


          webservice string aName;

          webservice string aNum;

 

         webservice string cName

    }

 

     global class Return

    {

        webservice string raName;

   }

 

   webservice static Return Allobjectsmethod(AllObjects a1)

   {

         Account a = new Account();

         a.Name  = a1.aName;

         a.Number = a1.aNum;

         insert a;

     

       Contact c  = new Contact();

        c.Name = a1.cName;

        insert c;

 

      Return r  =  new Return();

      r.raName = a.Name;

      return r;

 

 }

 

  by above webservice i am inserting only 1account,1contact,1opportunity at a time how can i insert multiple accounts, contacts

                may  i know where should i have to modifiy my code.

Abhi_TripathiAbhi_Tripathi

Is that all your code,

 

Have you tried to run the code, if yes then send me the error with line number

sathya82sathya82

@Abhi

 

 

         I run this code, i am not getting any error but by using above webservice i am inserting only 1 account at a time,

 

        but i want to modify my webservice insert multiple accounts at a time.

Abhi_TripathiAbhi_Tripathi

Thats perfect, so now you can write a batch or a trigger (bulk) usig this classes method

 

So then you can use the webservice to update your records in bulk

sathya82sathya82

@abhi

 

  Can you give me some trigger code based upon my  webservice

 

    

Abhi_TripathiAbhi_Tripathi

Hi,

 

here is an example

trigger TriggerAccount on Account (after insert, after update) {
    
    if(!System.isfuture()){ 
        if(Trigger.isAfter){
            if(Trigger.isInsert || Trigger.isUpdate){
            
                //calling helper class
              TriggerHelper.accountTwitterRatingUpdate(Trigger.newMap, Trigger.oldMap);      
            }
        }
    }
}

 Helper class

public with sharing class TriggerHelper {
  
  //method called by account Trigger
  public static void accountTwitterRatingUpdate(Map<Id, Account> mapAccount, Map<Id, Account> oldMapAccount) {
    
    //set of accountId 
    Set<Id> accId = new Set<Id>();
    
    //Iterating records   
       for(Account account : mapAccount.values()){  
             
         //YOUR LOGICS HERE        
         }
       }    
    }
}