problem with service cache

Hello,all
I’ve met a wired problem in wm service.
The varible changed back when doing the cache service.
Below, it’s the program logic.
loop 1…10
get id(adapter service : get sequence number: select seq.nextVal from dual)
invoke service: convertCode ( this is a cache service, id will not be mapped to this service )

I’m trying to run this service step by step and reset the cache at the beginning.
The wired thing is :
in the first loop , let’s say id is 10, everything works fine. But when go to the second loop, id=11, after the convertCode service, id was changed back to 10. In the next 8 loops, every time after the convertCode service, the id was changed to 10.

And there are three methods which can avoid this situation:
1: call convertCode in transformer
2: assign the scope in properties tab.
3: do not use cache
The question is :
1: if i copy convertCode to another service, everything works fine. if i use any other cache service, everything works fine. So is there any problem with my convertCode service? I’ve no idea with this situation.
2: in developer users guide. it says: wm will use the cache results if the input totally matched. And in wm 6.x (we are using 6.1), the only difference between normally service invocation and transformer invocation is the input and output.
In normal service invocation, the whole pipeline value will be the service input but in transformer, only the mapped values work. So the question is, the whole pipeline variables and the mapped variable, which will be the condition to use the cached results when normally invoke a cached service.
3: is there anyway i can check the cached values?

Any comments are highly appreciated.
Thanks in advance.
Regards!

the convertCode service is not the point.
I changed the cache service and met the same problem.
In the loop, when invoke cache service normally(no transformer used), and if id(the instance varies in each loop) is not mapped to the service cache, it will be changed back after the cache service.
So is this normal? or is there anyway to fix it? because i don’t want instance changes after the cache service and right now , invoke the cache service in transformer is really a heavy workload for us.
Thanks !

Shenjie,

This behaviour of service cacheing can be a little confusing, but is the way it is designed to work. It works as follows:

The key is that if the cacheing determines that cached results need to be returned, it returns the entire pipeline as it was at the time of cacheing, and not just the output variables defined for that service. So if you have a service with input inA and outputs outA and outB, but you also have $iteration in the pipeline, then for a later call to that service with the same inA as an earlier call, $iteration will be “overwritten” by the value that $iteration had when that earlier call was made. I guess this is what you are seeing.

As you correctly point out, the best way to avoid this is by using the cached service as a transformer, because that creates a separate pipeline for the invocation consisting only of the service’s mapped input values, so the pipeline being cached by the cached service is “clean”.
The other option is to use scoping, which has a similar effect, namely to isolate a part of the pipeline (one document) as the input pipeline to the cached service.

It is not possible to see exactly what is in the cache, but you can see how many results are cached in the Service Usage screen in IS Administrator. You can also trigger cache clearing there.

Hope this helps.

regards,

Jonathan Heywood
webMethods Professional Services

I got it. Thanks Jonathan.
Best Regards.

Shenjie

The other alternative is to use pub.flow:clearPipeline at the end of your cached service… I don’t recommend using clear pipeline for any other purpose, but for services that are going to be cached it is useful.

Just set the “preserve” list to be the names of the output variables and then you’re done.

Easiest way to think of service caching is a “savePipeline” call.

regards,
Nathan Lee