You need to sign in to do that
Don't have an account?
System.CalloutException: Endpoint can not be null
Hi all....how to fix this error in the below 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 date mydate;
webservice string added;
webservice String status;
webservice String Message_Text;
webservice integer statuscode;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
HttpRequest req=new HttpRequest();
Http http=new Http();
HttpResponse res = http.send(req);
retvalue.status='Success';
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
} catch(DMLException e) {
retvalue.mydate=system.today();
retvalue.statuscode=res.getStatusCode();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}catch (Exception e){
retvalue.mydate=system.today();
retvalue.statuscode=res.getStatusCode();
}
return retvalue;
}
}
Hello Reddy,
Whenever you do a HTTPrequest you have to specify the endpoint and authentication.
Only, If its publically accessible then you dont need Authentication (Username and password) but endpoint url is must.
Suppose the case is you are trying to connect to yahoo, then you put the url of Yahoo from where you actually login to website and specify method (Post, Get, etc.) and Authentication in header.
For more view this article :HTTPRequest Class
Actually this webservice is SFDC.....and it is called from external soap message....so how can i send http errors to back
FYI: You have not put the webservice call in try catch. so how will you be able to catch that error.
Put it in try catch.
example is given below, execute this in system log and check: