I have attached the WSDL2Apex class for getting data Sap to Salesforce. I am bit confused about this Apex code is correct or not for this WSDL file which is to connect the WSDL to get data from SAP.//Generated by wsdl2apex
public class sapComDocumentSapSoapFunctionsMcS { public class zsd_cust_det_webservice { public String endpoint_x = 'http://serverapp5.cssydney.local:80/sap/bc/srt/rfc/sap/zsd_cust_det_webservice/100/zsd_cust_det_webservice/zsd_cust_det_webservice'; 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:sap-com:document:sap:soap:functions:mc-style', 'sapComDocumentSapSoapFunctionsMcS', 'urn:sap-com:document:sap:rfc:functions', 'sapComDocumentSapRfcFunctions'}; public sapComDocumentSapSoapFunctionsMcS.ZsdTCustDet ZsdCustWebservDemo(String IvAcctNo) { sapComDocumentSapSoapFunctionsMcS.ZsdCustWebservDemo_element request_x = new sapComDocumentSapSoapFunctionsMcS.ZsdCustWebservDemo_element(); sapComDocumentSapSoapFunctionsMcS.ZsdCustWebservDemoResponse_element response_x; request_x.IvAcctNo = IvAcctNo; Map<String, sapComDocumentSapSoapFunctionsMcS.ZsdCustWebservDemoResponse_element> response_map_x = new Map<String, sapComDocumentSapSoapFunctionsMcS.ZsdCustWebservDemoResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, '', 'urn:sap-com:document:sap:soap:functions:mc-style', 'ZsdCustWebservDemo', 'urn:sap-com:document:sap:soap:functions:mc-style', 'ZsdCustWebservDemoResponse', 'sapComDocumentSapSoapFunctionsMcS.ZsdCustWebservDemoResponse_element'} ); response_x = response_map_x.get('response_x'); return response_x.EtAccDet; } } public class ZsdCustWebservDemo_element { public String IvAcctNo; private String[] IvAcctNo_type_info = new String[]{'IvAcctNo','urn:sap-com:document:sap:rfc:functions','char10','1','1','false'}; private String[] apex_schema_type_info = new String[]{'urn:sap-com:document:sap:soap:functions:mc-style','false','true'}; private String[] field_order_type_info = new String[]{'IvAcctNo'}; } public class ZsdSCustDet { public String AcctNo; public String SalesOrdNo; public String PoNo; public String PoDate; public String NetVal; public String Currency_x; private String[] AcctNo_type_info = new String[]{'AcctNo','urn:sap-com:document:sap:rfc:functions','char10','1','1','false'}; private String[] SalesOrdNo_type_info = new String[]{'SalesOrdNo','urn:sap-com:document:sap:rfc:functions','char10','1','1','false'}; private String[] PoNo_type_info = new String[]{'PoNo','urn:sap-com:document:sap:rfc:functions','char20','1','1','false'}; private String[] PoDate_type_info = new String[]{'PoDate','urn:sap-com:document:sap:rfc:functions','date','1','1','false'}; private String[] NetVal_type_info = new String[]{'NetVal','urn:sap-com:document:sap:rfc:functions','curr15.2','1','1','false'}; private String[] Currency_x_type_info = new String[]{'Currency','urn:sap-com:document:sap:rfc:functions','cuky5','1','1','false'}; private String[] apex_schema_type_info = new String[]{'urn:sap-com:document:sap:soap:functions:mc-style','false','true'}; private String[] field_order_type_info = new String[]{'AcctNo','SalesOrdNo','PoNo','PoDate','NetVal','Currency_x'}; } public class ZsdTCustDet { public sapComDocumentSapSoapFunctionsMcS.ZsdSCustDet[] item; private String[] item_type_info = new String[]{'item','urn:sap-com:document:sap:soap:functions:mc-style','ZsdSCustDet','0','-1','false'}; private String[] apex_schema_type_info = new String[]{'urn:sap-com:document:sap:soap:functions:mc-style','false','true'}; private String[] field_order_type_info = new String[]{'item'}; } public class ZsdCustWebservDemoResponse_element { public sapComDocumentSapSoapFunctionsMcS.ZsdTCustDet EtAccDet; private String[] EtAccDet_type_info = new String[]{'EtAccDet','urn:sap-com:document:sap:soap:functions:mc-style','ZsdTCustDet','1','1','false'}; private String[] apex_schema_type_info = new String[]{'urn:sap-com:document:sap:soap:functions:mc-style','false','true'}; private String[] field_order_type_info = new String[]{'EtAccDet'}; } }
Apex code: public class test {
public test(ApexPages.StandardController controller) {
}
public test(set<SAP__c> i)
{
list<SAP__c>lic=[select Name from SAP__c where id in: i]; for( SAP__c s:lic) {
sapComDocumentSapSoapFunctionsMcS.zsd_cust_det_webservice create=new sapComDocumentSapSoapFunctionsMcS.zsd_cust_det_webservice(); create.ZsdCustWebservDemo(s.Name);
} } }