- I have downloaded the WSDL file from this link: download.
- This WSDL contains 2 bindings, 2 ports so to generate apex class in Salesforce, I have removed the additional binding & port then I'm able to successfully generate apex class in Salesforce.
- After parsing, it generated 2 classes, I changed the names
a. Authentications
b. Authentication Apex Generated classes I have uploaded in GIthub https://github.com/ManjunadhManubolu/DevFiles/blob/master/ApexClass_1.txt https://github.com/ManjunadhManubolu/DevFiles/blob/master/ApexClass_2.txt
In ApexClass_1.txt file, I manually added below code in "TokenResponse" inner class to avoid the error "Unable to find field status"
public String Status; public String TrxResult; public String TokenId; public Integer UserId; private String[] Status_type_info = new String[]{'Status','http://www.campusmgmt.com/Soa/Foundation/MessageDefinition.xsd',null,'1','1','false'}; private String[] TrxResult_type_info = new String[]{'TrxResult','http://www.campusmgmt.com/Soa/Foundation/MessageDefinition.xsd',null,'0','1','false'}; private String[] TokenId_type_info = new String[]{'TokenId','http://www.campusmgmt.com/Soa/Foundation/MessageDefinition.xsd',null,'0','1','false'}; private String[] UserId_type_info = new String[]{'UserId','http://www.campusmgmt.com/Soa/Foundation/MessageDefinition.xsd',null,'0','1','false'};
Below error captured from Debug logs
ErrorSecurity GeTrxResultBusinessLogicFailedMessage~One or more messages failed execution. Please check each message TrxResult value for more details.
Below is my callout logic : GITBUBLINK
.
Public class AuthUserNamePassword
{
public static String getSessionid()
{
String Access_Token;
Authentication.TokenRequest reqParms = new Authentication.TokenRequest();
reqParms.UserName = 'usernamehere';
reqParms.Password = 'passwordhere';
reqParms.StaffId=36205;
Authentications.AuthenticationSoap req = new Authentications.AuthenticationSoap();
Access_Token =''+ req.GetAuthorizationToken(reqParms);
Account acc = new Account(Id='0017F000020VNEc',Description =Access_Token);
Update acc;
return Access_Token;
}
}
Kindly suggest me what I'm missing here.
I tested this service using SOAP UI, the response is generated without any issues (In the above point 5, I added additional fields because, in SOAP UI tool, the response contains additional fields but after generating apex class those fields are not there in TokenResponse class so I added there.)