+ Start a Discussion
abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com 

Soap Api from one org to another org

I developed  simple soap api from one of my org and consumed it in another one ....

 

When i am calling it from another org ....it gives me the below error

First error: Web service callout failed: WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session faultcode=sf:INVALID_SESSION_ID faultactor=

 

public class LogInfo {
public String category;
public String level;
private String[] category_type_info = new String[]{'category','http://soap.sforce.com/schemas/class/MyWebService','LogCategory','1','1','false'};
private String[] level_type_info = new String[]{'level','http://soap.sforce.com/schemas/class/MyWebService','LogCategoryLevel','1','1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/schemas/class/MyWebService','true','false'};
private String[] field_order_type_info = new String[]{'category','level'};

 

public class LoginHistory {
public String ApiType;
public String ApiVersion;
public String Application;
public String Browser;
public String ClientVersion;
public DateTime LoginTime;
public String LoginType;
public String LoginUrl;
public String Platform;
public String SourceIp;
public String Status;
public String UserId;
private String[] ApiType_type_info = new String[]{'ApiType','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] ApiVersion_type_info = new String[]{'ApiVersion','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] Application_type_info = new String[]{'Application','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] Browser_type_info = new String[]{'Browser','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] ClientVersion_type_info = new String[]{'ClientVersion','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] LoginTime_type_info = new String[]{'LoginTime','http://www.w3.org/2001/XMLSchema','dateTime','0','1','true'};
private String[] LoginType_type_info = new String[]{'LoginType','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] LoginUrl_type_info = new String[]{'LoginUrl','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] Platform_type_info = new String[]{'Platform','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] SourceIp_type_info = new String[]{'SourceIp','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] Status_type_info = new String[]{'Status','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] UserId_type_info = new String[]{'UserId','http://soap.sforce.com/schemas/class/MyWebService','ID','0','1','true'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/schemas/class/MyWebService','true','false'};
private String[] field_order_type_info = new String[]{'ApiType','ApiVersion','Application','Browser','ClientVersion','LoginTime','LoginType','LoginUrl','Platform','SourceIp','Status','UserId'};
}

 

 

public class LoginIp {
public DateTime ChallengeSentDate;
public DateTime CreatedDate;
public Boolean IsAuthenticated;
public String SourceIp;
public MYWebservice34.User_x Users;
public String UsersId;
private String[] ChallengeSentDate_type_info = new String[]{'ChallengeSentDate','http://www.w3.org/2001/XMLSchema','dateTime','0','1','true'};
private String[] CreatedDate_type_info = new String[]{'CreatedDate','http://www.w3.org/2001/XMLSchema','dateTime','0','1','true'};
private String[] IsAuthenticated_type_info = new String[]{'IsAuthenticated','http://www.w3.org/2001/XMLSchema','boolean','0','1','true'};
private String[] SourceIp_type_info = new String[]{'SourceIp','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
private String[] Users_type_info = new String[]{'Users','http://soap.sforce.com/schemas/class/MyWebService','User','0','1','true'};
private String[] UsersId_type_info = new String[]{'UsersId','http://soap.sforce.com/schemas/class/MyWebService','ID','0','1','true'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/schemas/class/MyWebService','true','false'};
private String[] field_order_type_info = new String[]{'ChallengeSentDate','CreatedDate','IsAuthenticated','SourceIp','Users','UsersId'};
}

 

 

how to rectify the error?????

THanks

SurpriseSurprise

You need to post your code,it seems that you are not sending sesionid properly with the object of the class in which your method has been defined.


Are u using enterprise/ partner wsdl of one salesforce org in another salesforce org?

abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com
Both are dev editions, what code I need to paste because the code of consumed wsdl is more than 4000 lines
SurpriseSurprise

I am assuming you are using  parthner wsdl .The errror is coming because you are not passing session id  as part of the request when u are calling your custom web service .

 

Have u develoeped any custom web service using apex ?

 

Ok,Can u put the code which gives you erorr.

abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com
What code u require pls specify as said earlier the custom Webservice of mine is above 5000 lines ....And the Custom webservice that i generated is simple Controller and thus made the wsdl from Generate Wsdl button on Classes page....Pls Reply
gaurav.agrawal91.3963408275063662E12gaurav.agrawal91.3963408275063662E12
Hi ,

I am also getting the same error, can anyone suggest on the same, please refere the link https://developer.salesforce.com/forums/ForumsMain?id=906F00000009u2h