You need to sign in to do that
Don't have an account?
![pfarrell pfarrell](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
SOA from Apex Trigger?
I am new to Apex Code development and am trying to get a trigger to call a web service (imported into Apex Code via wsdl).
This is a simple web service hitting http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=51 (a whois lookup service) for a test.
The wsdl imported correctly and I am now trying to utilze the web service in an Apex trigger. Here's the code for the call.
trigger helloWorldTrigger on Account (before insert) {
Account[] accs = Trigger.new;
MyHelloWorld.addHelloWorld(accs);
}
I'm reading this error as an indication that Apex triggers currently cannot perform an interaction with web services. Am I interpreting this error correctly?
Account[] accs = Trigger.new;
MyHelloWorld.addHelloWorld(accs);
}
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger helloWorldTrigger caused an unexpected exception, contact your administrator: helloWorldTrigger: execution of BeforeInsert caused by: System.CalloutException: Callout from triggers are currently not supported.: Class.wxWhois.whoisSoap.GetWhoIS: line 19, column 13
I'm reading this error as an indication that Apex triggers currently cannot perform an interaction with web services. Am I interpreting this error correctly?
Is there any way to use SalesforceSOA through Apex without being in response to UI action (i.e. a button click)?
Message Edited by pfarrell on 08-22-2007 07:01 AM
This is a rather old thread so this process may have been updated since 2007, but we were able to call a web service from a trigger by ensuring the called service method was set with:
This appears to be working as no exception is being thrown in the logs.