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
dragon123dragon123 

how can i call generated apex class in trigger?

public class intrigoSoapSforceCom123 {
    public class Response_element {
        public String sapno;
        private String[] sapno_type_info = new String[]{'sapno','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'sapno'};
    }
    public class SFDCResponse {
        public intrigoSoapSforceCom123.Response_element[] Response;
        private String[] Response_type_info = new String[]{'Response','urn:intrigo.soap.sforce.com','Response_element','1','-1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'Response'};
    }
    public class Employee_element {
        public String EmployeeNo;
        public String Ename;
        public String Salary;
        private String[] EmployeeNo_type_info = new String[]{'EmployeeNo','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Ename_type_info = new String[]{'Ename','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Salary_type_info = new String[]{'Salary','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'EmployeeNo','Ename','Salary'};
    }
    public class SI_SFDC_OUTPort {
        public String endpoint_x = 'http://ca-test02.intrigosys.com:52000/XISOAPAdapter/MessageServlet?channel=party:BC_SFDCTEST:CC_SENDER_SFDC&version=3.0&Sender.Service=BC_SFDCTEST&Interface=urn%3Aintrigo.soap.sforce.com%5ESI_SFDC_OUT';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:intrigo.soap.sforce.com', 'testSoapSforceCom123'};
        public intrigoSoapSforceCom123.Response_element[] SI_SFDC_OUT(testSoapSforceCom123.Employee_element[] Employee) {
            intrigoSoapSforceCom123.SfdcTest_Request request_x = new intrigoSoapSforceCom123.SfdcTest_Request();
            intrigoSoapSforceCom123.SFDCResponse response_x;
            request_x.Employee = Employee;
            Map<String, intrigoSoapSforceCom123.SFDCResponse> response_map_x = new Map<String, intrigoSoapSforceCom123.SFDCResponse>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://sap.com/xi/WebService/soap1.1',
              'urn:intrigo.soap.sforce.com',
              'MT_SFDC_Request',
              'urn:intrigo.soap.sforce.com',
              'MT_SFDC_Response',
              'intrigoSoapSforceCom123.SFDCResponse'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.Response;
        }
    }
    public class SfdcTest_Request {
        public intrigoSoapSforceCom123.Employee_element[] Employee;
        private String[] Employee_type_info = new String[]{'Employee','urn:intrigo.soap.sforce.com','Employee_element','1','-1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'Employee'};
    }
}

 

how can i call generated apex  class in trigger?

 

custom object - employee (eno ,ename ,salary)

imutsavimutsav

Try this and let me know if it works. (It would only work if your generated code is not Web Service Call). Currently call outs are not supported in apex triggers. However you can put the below logic into an apex class and mark it as @future and then call it using aysnc call.

intrigoSoapSforceCom123.Response_element Res = new intrigoSoapSforceCom123.Response_element();
intrigoSoapSforceCom123.Response_element wsbnaedi = intrigoSoapSforceCom123.Response_element();
Res = wsbnaedi.SI_SFDC_OUT(testSoapSforceCom123.Employee_element[] Employee);//pass the correct data
String myRecords = Res.sapno;

 

Check this tutorial. It would be helpful.

 

http://cheenath.com/?tutorial/sfdc/sample1/index.html


Thanks
Utsav

[Do mark this answer as solution if it works for you and give a kudos.]

sandeep@Salesforcesandeep@Salesforce

if I am undertanding you question correctly then you are asking how to call method of Classes in Trigger Code. 

 

then it is very simple to do by creating instances in Trigger and then call method of class in trigger code..

 

like ClassName clsObj = new ClassName();

 

clsObj.methodName();

 

Please give KUDOS if you get help from it and mark it as solution

 

dragon123dragon123

How can i frame this code in Apex class?

 

Any endpoint,username,password mention the new call apex class

imutsavimutsav
Did you try this ? Create a class and put this code into that class.

intrigoSoapSforceCom123.Response_element Res = new intrigoSoapSforceCom123.Response_element();
intrigoSoapSforceCom123.Response_element wsbnaedi = intrigoSoapSforceCom123.Response_element();
Res = wsbnaedi.SI_SFDC_OUT(testSoapSforceCom123.Employee_element[] Employee);//pass the correct data
String myRecords = Res.sapno;

Thanks
Utsav

[Do mark this answer as solution if it works for you and give a kudos.]