You need to sign in to do that
Don't have an account?
radixweb@hotmail.com
How to call WCF RESTFul Service on Account(after update)
Hello Everyone, I am facing one problem, I would like to Call WCF RESTFull Service on Account(after update). I would like to create one XML file based on Accound updation. I have written given below Trigger. trigger trgUpdate on Account(after update) { Http http = new Http(); HttpRequest reqL = new HttpRequest(); reqL.setTimeout(60000); reqL.setEndpoint('http://restful.live2.dev.radixweb.net/RestServiceImpl.svc'); reqL.setMethod('GET'); reqL.setHeader('SOAPAction', 'http://restful.live2.dev.radixweb.net/RestServiceImpl.svc'); reqL.setHeader('SetHelloWorld', 'SFDC-Callout/22.0'); reqL.setHeader('Accept','text/xml'); reqL.setHeader('Content-type','text/xml'); reqL.setHeader('charset','UTF-8'); reqL.setBody('This is testing.'); try { HTTPResponse res = hL.send(reqL); System.debug(res.toString()); System.debug('STATUS:'+res.getStatus()); System.debug('STATUS_CODE:'+res.getStatusCode()); } catch(System.CalloutException e) { //Exception handling goes here.... } } // My WCF RESTFULL Service Method [OperationContract] [WebGet(UriTemplate = "/SetHelloWorld", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Xml)] void SetHelloWorld(); I am waiting for valuable feedback. Thanks.
Hi
without getting to deep into your callout params, the first problem is that Salesforce does not allow you to perform a synchronous callout in the middle of a transaction (for instance - a trigger firing).
The solution is to perform the callout ASync (in salesforce terms - invoke a @future anotated record).
please see your code below with a small adjustment: