The short answer is don't.
Use of pub.flow:clearPipeline is dangerous for the following reasons:
- it blows away everything in the pipeline, but the design time view of the pipeline appears as though the variables are still there
- maintaining the list of exception variables is generally tricky to remember to do, so it is a timebomb waiting to go off
- it's a sign of bad coding, you should properly maintain the pipeline by dropping unused variables when necessary and writing clean services (that only return their listed outputs in the pipeline rather than "hidden" variables"
Use scoping of the pipeline to provide a "clean" pipeline for a service to invoke and return its results onto. To do this create a document (record in version4.6) in the pipeline. Map any inputs into that document structure. For your invoke step go to the properties and set the "scope" property to the name of your document.
If the outputs of the service are required: map them out of the structure and then cleanup the structure to avoid leaving junk in the pipeline.