function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ales.pales.p 

Invoke Apex Class Web Service from workflow message (SOAP)

Is there a way to invoke Apex Class Web Service from workflow message action (SOAP)?

We built a simple APEX class and we would like to call that class from workflow message action passing URL Endpoint and Sessiond ID.
We receive this error from the message queue: "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session"

Apex class is very simple for testing purpose:

global class HelloWorld2 {
 WebService static void sayHelloWorld(String arg)
{
Lead lead;
lead = new Lead();
lead.firstname = 'Name name';
lead.lastname = 'Surname';

insert lead;
}

}

Endpoint for workflow message action setup is:
https://na4-api.salesforce.com/services/Soap/class/HelloWorld2

Any help about that?

Ron HessRon Hess
I don't think you are permitted to use an outgoing workflow message to call a webservice. This is effectively plugging a platform output into an input and we detect it and block that usage.

Message Edited by Ron Hess on 07-19-2008 10:03 PM
SuperfellSuperfell
No, you should instead write a trigger and use the apex future feature (which is in developer preview)
ales.pales.p

We use triggers only if extremely required. In most cases we found that we need to give the administrator the ability to change some conditions prior to invoke the apex class.

So we thought about doing that with workflow message SOAP and Apex WebService Class.
Waiting for that feature we build a composite external WebService that simply create a new record and is invoked as required from a Workflow SOAP message.

Thanks again for you help.

 

 

softsquaresoftsquare
In our case, we need to invoke a Report programmatically (with a Http invocation from an Apex class) as a result of a Workflow action. Unfortuantely, when we invoke the Apex class from an Apex trigger, we get a "No callout service from trigger" error.
In essence. how do we get a Workflow action to generate a report automatically?

Andi Giri
SuperfellSuperfell
see my previous note on using the apex @future feature.
asgirisoftasgirisoft

Simon,

 

I am attempting to invoke a Report URL using Http Apex method.

This code is on an Apex class's method that has been "future" annotated. 

This Apex class has been invoked by a trigger that is time-based. 

Since there is no session context on a time-based trigger, the Http callout fails to return the report's Excel content. How do I get this to work? This task (obtaining a report's output programmatically) is effortless on a PHP program. Why is this such a pain from an Apex class?

 

Andi Giri

Softsquare