5-1-4-8. Call SkyOnDemand Service HTTP Trigger (GET Method)
Call SkyOnDemand Service(※1) HTTP trigger and assign the result message into a variable ("message" in sample code).
There are many ways to display result messages which vary depending on the processing time and specifications of SkyOnDemand service. Please note the details of displaying a result message is not covered in this sample code.
※1 SkyOnDemand Service
http://www.terrasky.com/skyondemand/
Check HTTP trigger information in SkyOnDemand service.
For details about how to login as well as how to display information, refer to the Help document of SkyOnDemand service.
【HTTP Trigger Information】
Visualforce page name: SamplePage
Apex class of the extension page: SkyEditorClass
global class MyExtender extends SkyEditor2.Extender { String headerId {get;set;} String url {get;set;} String domain {get;set;} public transient String message {get;set;} public MyExtender(SkyEditorClass extension){ } public PageReference doCallout(){ this.headerId = ApexPages.currentPage().getParameters().get('id'); this.domain = ApexPages.currentPage().getHeaders().get('Host'); if ( domain != null){ List<String> domainList = domain.split('\\.'); url = 'https://' + domainList.get(1); if(domainList.get(1)== 'ap0'){ url = 'https://ap'; }else{ url = 'https://' + domainList.get(1); } } else { url = 'https://ap'; // example in the case of Asia Pasific } url = url + '.salesforce.com/apex/SamplePage?id=' ; String endpoint = 'https://www.skyondemand.net/ws/trigger/(4)?cid=a0G1000000LYRvbEAH&sid=10153&ak=(3)'; String username = '(1)'; String password = '(2)'; HttpRequest req = new HttpRequest(); req.setEndpoint(endpoint + '&i-mId=' + headerId + '&i-retUrl=' + url + headerId ); req.setMethod('GET'); Blob headerValue = Blob.valueOf(username + ':' + password); String authHeader = 'BASIC' + EncodingUtil.base64Encode(headerValue); req.setHeader('Authorization',authHeader); req.setTimeout(60000); try{ Http http = new Http(); HttpResponse res = http.send(req); message = res.getBody(); }catch(CalloutException ce){ system.debug('CalloutException' + ce); }catch(Exception e){ system.debug('Exception' + e); } return null; } }