You need to sign in to do that
Don't have an account?
Varun Sinha 17
Web service callout failed: WebService returned a SOAP Fault: Fail creating session for token
I have a visual force page that is calling an external web service and whenever I invoke the method on the web service I get this error.
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Fail creating session for token 'oEP0N1VHM4yLFOytdDwSSRpuXsW+s4LMnypVDYU8/X8afi3kUJxen26ZStVyyy5s'. faultcode=soap:Server faultactor=
Any help would be greatly appreciated.
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Fail creating session for token 'oEP0N1VHM4yLFOytdDwSSRpuXsW+s4LMnypVDYU8/X8afi3kUJxen26ZStVyyy5s'. faultcode=soap:Server faultactor=
Any help would be greatly appreciated.
global class SoapEDSClass {
public string userName{get;set;}
//public string userName1{get;set;}
public string userGroup{get;set;}
//public string userGroup1{set;}
//public string username1{get;set;}
public string systemDate{get;set;}
public string token{get;set;}
public string getgenerateToken{set;}
public string encryptedKey{get;set;}
public SoapEDSClass(){
String locale = 'en';
userGroup=System.Label.UserGroup;
userName=System.Label.UserName;
encryptedKey = getgenerateToken(userName,userGroup);
// System.debug('>> encryptedkey >> ' + encryptedKey);
// Datetime yourDate = Datetime.now();
// Datetime yourDate1 = System.now();
//string sessionID=login(encryptedKey,'en');
//systemDate=yourDate.format('yyyyMMddhhmmss');
//TimeZone tz = UserInfo.getTimeZone();
//System.debug('The time is'+yourDate);
//System.debug('The time one is'+yourDate1);
token=userName+';'+userGroup+';datetime-'+systemDate;
string session=login(encryptedKey,locale);
System.debug('The session id'+session);
}
@RemoteAction
global static string getgenerateToken(string userName,string userGroup){
Blob key = Crypto.generateAesKey(128);
string passPhrase = 'wEC38PruRaSw.bEm';
Blob secretKey = Blob.valueOf(passPhrase);
Blob tokenString = Blob.valueOf(getToken(userName,userGroup));
//return tokenString;
// Blob encryptedStr = Crypto.encryptWithManagedIV('AES128', secretKey, tokenString);
Blob encryptedStr = Crypto.encrypt('AES128',secretkey,secretKey,tokenString);
System.debug('>> encryptedStr >> ' + encryptedStr);
String encodedEncrypedStr = EncodingUtil.base64Encode(encryptedStr);
System.debug('>> encodedEncrypedStr >> ' + encodedEncrypedStr);
return encodedEncrypedStr;
}
//Generate token based on the passed user name and group
public static String getToken(String userName, String userGroup){
//DateTime dt = DateTime.now();
DateTime dt = System.now();
//String dt1=dt.formatGMT('hhmmss');
//String dt2=dt.format('yyyymmdd');
//System.debug('The dt1 is'+dt1);
//System.debug('The dt2 is'+dt2);
String dateTimeStr = dt.formatGMT('yyyyMMddhhmmss');
System.debug('The datetimeStr is'+dateTimeStr);
String tokenStr = userName+';'+userGroup+';datetime-'+dateTimeStr;
System.debug('>> tokenStr >> ' + tokenStr);
return(tokenStr);
}
@RemoteAction
global Static string login(String tokenID,String locale){
//global static wwwKaidaraComKaidaraserviceCSS.kaidaraSession login(String tokenID,String locale) {
// Http httpProtocol = new Http();
String username = 'cssapp'; //"scharette';
String password = 'css4ever'; //"";
//HTTPRequest r = new HTTPRequest();
//string endpointurl='https://edstest.ptcmanaged.com/wservice/services/KaidaraService';
//r.setEndpoint(endpointurl);
Blob beforeblob = Blob.valueOf(username+':'+password);
string paramvalue = EncodingUtil.base64Encode(beforeblob);
//r.setMethod('POST');
// r.setHeader('Authorization', authorizationHeader);
wwwKaidaraCom.loginWithToken loginDetails = new wwwKaidaraCom.loginWithToken();
loginDetails.locale=locale;
loginDetails.token=tokenID;
String authorizationHeader = 'Basic ' + paramvalue;
//r.setHeader('Authorization', authorizationHeader);
wwwKaidaraComKaidaraservice.kaidaraSession sesID = new wwwKaidaraComKaidaraservice.kaidaraSession();
//wwwKaidaraComKaidaraserviceCSS.kaidaraSession sesID = new wwwKaidaraComKaidaraserviceCSS.kaidaraSession();
//wwwKaidaraCom.loginWithTokenResponse sesID = new wwwKaidaraCom.loginWithTokenResponse();
// wwwKaidaraComCSS.KaidaraServiceImplPort wsCall = new wwwKaidaraComCSS.KaidaraServiceImplPort();
wwwKaidaraCom.KaidaraServiceImplPort wsCall = new wwwKaidaraCom.KaidaraServiceImplPort();
wsCall.inputHttpHeaders_x = new Map <String, String>();
wsCall.inputHttpHeaders_x.put('Authorization', authorizationHeader);
//HttpResponse response = httpProtocol.send(r);
//System.debug(response);
sesID = wscall.loginWithToken(loginDetails.token,loginDetails.locale);
string a=string.valueOf(sesID);
System.debug('The string is'+a);
System.debug('The sess ID is'+sesID.key);
System.debug('The name is'+sesID.name);
//return sesID;
return a;
}
/*public Static wwwKaidaraComKaidaraservice.kaidaraSession doWebServiceLogin(wwwKaidaraComKaidaraservice ks, String UserName, String Password,String UserGroup,String Address,String tknUser) {
wwwKaidaraComKaidaraservice.kaidaraSession sesID=NULL;
sesID=wwwKaidaraCom.loginWithToken(UserName,'en');
return sesID;
}*/
}
From SOAP UI WHEN I AM PASSING THE TOKEN, Error which I am getting is
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Fail creating session for token 'oEP0N1VHM4yLFOytdDwSSRpuXsW+s4LMnypVDYU8/X8q4vznJ0epj60Rhce8ksw/'.</faultstring>
<detail>
<ns1:Exception xmlns:ns1="http://www.kaidara.com/"/>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Can you let me know what the problem is?Thanx in advance
System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element diagnosticSessionStatus.
Can you help me with this?
Thanx