You need to sign in to do that
Don't have an account?
Help me with this webservice code
I have a requirement to fetch all the record ids of a custom object called Meetings (Api name Event__c),
This webservice is being called from a Asp.Net website .
The requirement is to get all the record ids in a drop down list in Asp.net.
Please help me with this code , and let me know how far is this correct and what needs to be done..
global class MeetingId{
global class meetingWrapper{
webservice List<Event__c> Meetings;
global meetingWrapper(List<Event__c> mList){
Meetings = mList;
}
}
webservice static List<meetingWrapper> getMeetingsWebMethod(){
List<meetingWrapper> Meetings = new List<meetingWrapper>();
try{
HTTPResponse res = new HTTPResponse();
Http http = new Http();
HttpRequest req = new HttpRequest();
String EndPoint = 'https://www.tctmd.com/services/api.aspx?';
req.setEndpoint(EndPoint);
req.setMethod('GET');
req.setTimeout(120000);
req.setHeader('Content-Type', 'application/json');
req.setHeader('Content-Length','1024');
req.setCompressed(true);
res = http.send(req);
list<Event__c> meetingList = new list<Event__c>();
meetingList.clear();
meetingList = [select id from Event__c];
Meetings.add(new meetingWrapper(meetingList));
}catch(Exception ex){
ErrorLogHandler_Class.createLog('SPM',ex);
}
return Meetings;
}
}
Hi,
Try to generate and consume Enterprise WSDL in your .net application.
If that does not help try to explain the requirement in detail? I am little bit confused with the code - you are trying both webservice and callout on the same code.
Cheers,
J