You need to sign in to do that
Don't have an account?
Invalid Session Id
Hi,
I have generated Apex Class from WSDL and i m invoking it but i m getting Invalid Session Id.
Any Help in this would be great.
The Apex Class is
//Generated by wsdl2apex
public class AccountplanWSDL {
public class LogInfo {
public String category;
public String level;
private String[] category_type_info = new
String[]{'category','http://soap.sforce.com/schemas/class/AccountPlan','LogCategory','1','1','false'};
private String[] level_type_info = new
String[]{'level','http://soap.sforce.com/schemas/class/AccountPlan','LogCategoryLevel','1','1','false'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'category','level'};
}
public class AllowFieldTruncationHeader_element {
public Boolean allowFieldTruncation;
private String[] allowFieldTruncation_type_info = new
String[]{'allowFieldTruncation','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'allowFieldTruncation'};
}
public class DebuggingHeader_element {
public AccountplanWSDL.LogInfo[] categories;
public String debugLevel;
private String[] categories_type_info = new
String[]{'categories','http://soap.sforce.com/schemas/class/AccountPlan','LogInfo','0','-1','false'};
private String[] debugLevel_type_info = new
String[]{'debugLevel','http://soap.sforce.com/schemas/class/AccountPlan','LogType','1','1','false'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'categories','debugLevel'};
}
public class CallOptions_element {
public String client;
private String[] client_type_info = new String[]{'client','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'client'};
}
public class AccountPlan {
public String endpoint_x = 'https://na6-api.salesforce.com/services/Soap/class/AccountPlan';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
public AccountplanWSDL.SessionHeader_element SessionHeader;
public AccountplanWSDL.DebuggingInfo_element DebuggingInfo;
public AccountplanWSDL.AllowFieldTruncationHeader_element AllowFieldTruncationHeader;
public AccountplanWSDL.DebuggingHeader_element DebuggingHeader;
public AccountplanWSDL.CallOptions_element CallOptions;
private String SessionHeader_hns = 'SessionHeader=http://soap.sforce.com/schemas/class/AccountPlan';
private String DebuggingInfo_hns = 'DebuggingInfo=http://soap.sforce.com/schemas/class/AccountPlan';
private String AllowFieldTruncationHeader_hns =
'AllowFieldTruncationHeader=http://soap.sforce.com/schemas/class/AccountPlan';
private String DebuggingHeader_hns = 'DebuggingHeader=http://soap.sforce.com/schemas/class/AccountPlan';
private String CallOptions_hns = 'CallOptions=http://soap.sforce.com/schemas/class/AccountPlan';
private String[] ns_map_type_info = new String[]{'http://soap.sforce.com/schemas/class/AccountPlan', 'AccountplanWSDL'};
public AccountplanWSDL.Plan createAccountPlan(AccountplanWSDL.Plan vPlan) {
AccountplanWSDL.createAccountPlan_element request_x = new AccountplanWSDL.createAccountPlan_element();
AccountplanWSDL.createAccountPlanResponse_element response_x;
request_x.vPlan = vPlan;
Map<String, AccountplanWSDL.createAccountPlanResponse_element>
response_map_x = new Map<String,
AccountplanWSDL.createAccountPlanResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://soap.sforce.com/schemas/class/AccountPlan',
'createAccountPlan',
'http://soap.sforce.com/schemas/class/AccountPlan',
'createAccountPlanResponse',
'AccountplanWSDL.createAccountPlanResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.result;
}
}
public class createAccountPlanResponse_element {
public AccountplanWSDL.Plan result;
private String[] result_type_info = new
String[]{'result','http://soap.sforce.com/schemas/class/AccountPlan','Plan','1','1','true'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'result'};
}
public class SessionHeader_element {
public String sessionId;
private String[] sessionId_type_info = new
String[]{'sessionId','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'sessionId'};
}
public class createAccountPlan_element {
public AccountplanWSDL.Plan vPlan;
private String[] vPlan_type_info = new
String[]{'vPlan','http://soap.sforce.com/schemas/class/AccountPlan','Plan','1','1','true'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'vPlan'};
}
public class DebuggingInfo_element {
public String debugLog;
private String[] debugLog_type_info = new
String[]{'debugLog','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'debugLog'};
}
public class Plan {
public String name;
public String planId;
public Date planningPeriod;
public Integer planNumber;
private String[] name_type_info = new String[]{'name','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] planId_type_info = new
String[]{'planId','http://soap.sforce.com/schemas/class/AccountPlan','ID','0','1','true'};
private String[] planningPeriod_type_info = new
String[]{'planningPeriod','http://www.w3.org/2001/XMLSchema','date','0','1','true'};
private String[] planNumber_type_info = new
String[]{'planNumber','http://www.w3.org/2001/XMLSchema','int','0','1','true'};
private String[] apex_schema_type_info = new
String[]{'http://soap.sforce.com/schemas/class/AccountPlan','true','false'};
private String[] field_order_type_info = new String[]{'name','planId','planningPeriod','planNumber'};
}
}
Invoking Method is
AccountplanWSDL.AccountPlan accObj = new AccountplanWSDL.AccountPlan();
AccountplanWSDL.Plan planObj = new AccountplanWSDL.Plan();
planObj.name = 'Junaid';
planObj.planId = '0123';
Date myDate = date.newinstance(2009, 2, 17);
planObj.planningPeriod =myDate ;
planObj.planNumber=123;
AccountplanWSDL.Plan newPlanObj = accObj.createAccountPlan(planObj);
system.debug('-----------newPlanObj-----------'+newPlanObj);
Regards,
Mohammed Junaid