lib/openwfe/participants/soapparticipants.rb in openwferu-0.9.12 vs lib/openwfe/participants/soapparticipants.rb in openwferu-0.9.12.863

- old
+ new

@@ -28,12 +28,10 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. #++ # -# $Id$ -# # # "made in Japan" # # John Mettraux at openwfe.org @@ -55,12 +53,18 @@ # "getQuote", # operation name # [ "symbol" ]) # param arrays (workitem fields) # # engine.register_participant("quote_service", quote_service) # - # You can override the method handle_call_result for better mappings - # between web service calls and the workitems. + # By default, call params for the SOAP operations are determined by + # iterating the parameters and fetching the values under the + # corresponding workitem fields. + # This behaviour can be changed by overriding the prepare_call_params() + # method. + # + # On the return side, you can override the method handle_call_result + # for better mappings between web service calls and the workitems. # class SoapParticipant include LocalParticipant def initialize \ @@ -75,10 +79,14 @@ @param_prefix = param_prefix @driver.add_method(method_name, *params) end + # + # The method called by the engine when the flow reaches an instance + # of this Participant class. + # def consume (workitem) call_params = prepare_call_params(workitem) call_result = @driver.send(@method_name, *call_params) @@ -95,11 +103,11 @@ # Feel free to override this method. # def prepare_call_params (workitem) @params.collect do |param| - get_param(workitem, param) + get_param workitem, param end end # # This implementation simply stuffs the result into the workitem @@ -115,12 +123,11 @@ protected def get_param (workitem, param_name) param_name = @param_prefix + param_name if @param_prefix - r = workitem.attributes[param_name] - return r if r - return "" + + workitem.attributes[param_name] || "" end end end