// Every webMethods Integration Server service has exactly one input // argument: the pipeline. // // The pipeline is like a javascript object that gets passed to each // service that gets called. (It's actually a com.wm.data.IData object, // which is essentially a hash table.) // // Because objects are passed by reference, every service or function // called can alter the keys and values in the pipeline. // // This is an example of how the webMethods Integration Server pipeline // would work if it was implemented in javascript. // // $ node pipeline.js var inspect = require('util').inspect; function greet(pipeline) { // convert the name argument to upper case pipeline.instring = pipeline.name; upcase(pipeline); pipeline.name = pipeline.outstring; // get honorific honorific(pipeline); // return greeting variable pipeline.greeting = 'Hello ' + pipeline.honorific + ' ' + pipeline.name; } function upcase(pipeline) { pipeline.outstring = pipeline.instring.toUpperCase(); } function honorific(pipeline) { if (pipeline.gender === 'male') { pipeline.honorific = 'Mr'; } else if (pipeline.gender == 'female') { pipeline.honorific = 'Ms'; } else { pipeline.honorific = ''; } } // declare a pipeline var pipeline = { name: 'John Doe', gender: 'male', email: 'john.doe@example.com', address: '123 Sycamore Street' } // call the greet function, passing in the pipeline // => Hello Mr JOHN DOE greet(pipeline); console.log("greeting = " + pipeline.greeting); console.log("pipeline = " + inspect(pipeline));