You need to sign in to do that
Don't have an account?

send error messages
Hi all, please help me.....i want to throw http error messages in this code with the status code.....
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
Account account=new Account();
account.National_Code__c=userregistration.UserId;
account.FirstName=userregistration.First_Name;
account.LastName=userregistration.Last_Name;
account.PersonEmail=userregistration.Email_Address;
account.Account_Status_NES__c=userregistration.Status;
account.Primary_Parent_vod__c=userregistration.Workplace_Id;
account.Primary_Province_NES__c=userregistration.Workplace_Province;
account.Primary_City_NES__c=userregistration.Workplace_City;
account.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
account.Primary_Address_1_NES__c=userregistration.Workplace_Address;
account.Specialty_1_vod__c=userregistration.Speciality;
account.RecordTypeId=userregistration.Record_Type;
try{
insert account;
} catch (Exception e){
retvalue.Status='Failure';
retvalue.Message_text=e.getMessage();
}
return retvalue;
}
}
may be this will be useful to you
HttpResponse res = http.send(req);
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
All Answers
may be this will be useful to you
HttpResponse res = http.send(req);
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
what is req