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
Ezio_2010Ezio_2010 

OutBound messages feature

Alo:

 

Hope someone help me, i want to integrate salesforce app with a jee app, so im using web services api and this workflow feature, that is outbound messages, but what the...cant make heads nor tails of it.

 

The easy thing is (or at least it seems easy):

 

1. I got an object A, on the screen, I have a button and it will trigger some event, suppose populate new object B and save it.

 

2. After save object B, I have to send some fields of object A to my web service.

 

3. I have to get a response from my web service, with some id created there.

 

4. Set that id on object B and A.

 

 

the problem is, I cannot understand why if i create an outbound message, I have to use the wsdl created by force engine, why cant i call my wsdl.

 

I already parse wsdl of mine and made a class from it, but when I invoke that class within a trigger, it didn't work, some callout not permited or the like...not sure now. Then I searched on salesforce forum, and Simon was telling other guy to use outbound messages...xD

 

any help ?

 

thanks 4 reading

SuperfellSuperfell

Outbound messaging is a one way, reliable notification of events from salesforce.com. You would have to have your webservice use the specific OM WSDL, and use the serverUrl / sessionId in the message to make changes in salesforce.com when it receieves a message.

 

The other option, would be to use the @future anotation in apex so that your trigger can make the callout, this will let you use your own WSDL, but it will also require you to handle the reliability part yourself. 

Ezio_2010Ezio_2010
Thanks for replying man... If they are one way...then how can i assure theres a response, a response i have to make after this message :(. I just got one web service that recieves the sales force message, but i want to give a response to give back data i created on my app jee side. Any suggestions?
SuperfellSuperfell
You can't, if you need to change data in salesforce, then from your listener, you need to make new API calls to salesforce (the serverUrl & sessionId are in the message to help make this easier).
Ezio_2010Ezio_2010
Still bothering u, if i got ej a wsdl, then I generate a APex class, so i got something like... public class ivrPocMobilizInterwareComMx { public class getDate_element { private String[] apex_schema_type_info = new String[]{'http://ivr.poc.mobiliz.interware.com.mx','true','false'}; private String[] field_order_type_info = new String[]{}; } public class BasicCallerInfo { public Double balance; public String callerId; public Integer language; public Boolean registered; private String[] balance_type_info = new String[]{'balance','http://www.w3.org/2001/XMLSchema','double','1','1','true'}; private String[] callerId_type_info = new String[]{'callerId','http://www.w3.org/2001/XMLSchema','string','1','1','true'}; private String[] language_type_info = new String[]{'language','http://www.w3.org/2001/XMLSchema','int','1','1','true'}; private String[] registered_type_info = new String[]{'registered','http://www.w3.org/2001/XMLSchema','boolean','1','1','true'}; private String[] apex_schema_type_info = new String[]{'http://ivr.poc.mobiliz.interware.com.mx','true','false'}; private String[] field_order_type_info = new String[]{'balance','callerId','language','registered'}; } Can you please give me an example where I can use this class? I tried ... global with sharing class WebServicePrueba { public static void shamaWS(Account[] accs) { ivrPocMobilizInterwareComMx.CallerMgr caller = new ivrPocMobilizInterwareComMx.CallerMgr(); String fechona = caller.getDate(); for (Account a : accs) { a.PruebaCampo__c = fechona; } } } AND tried call this class from a tigger, didnt work as we already know, so, how can I ?
SuperfellSuperfell
If you want to make callouts from a trigger, you need to use the @future keyword, see the docs & the posts in the apex forum about it.
Ezio_2010Ezio_2010
Yeahh, apex rulez!!!
but... yes there is a "but"...
See, got a trigger, with @future, everyone is happy now but...I see it executes asynchronously!!!!
copy and paste of sf man...For example, you can use the future annotation when making an asynchronous Web service callout to an external service. Without the annotation, the Web service callout is made from the same thread that is executing the Apex script, and no additional processing can occur until the callout is complete (synchronous processing).
In few words, I have to use future annotation, and if I want to use synchronous processing, I dont know where to use it, because in trigger is not allow...anyway This is not for you to answer me, i just wanted to state this fact...