Create a service that the ping service calls to store the “UseSecondary” flag somewhere (lots of choices on doing this–savePipeline probably not the best but maybe it would work okay).
Create another service, in the same package as the first, that returns the value of the flag. Be sure the implementation is thread safe.
In your infinite loop service, call the 2nd service above. Based on the returned value, use the appropriate URL.
Another approach that might work: in the infinite loop service, have it keep track of which URL it should use. When one URL fails, switch to using the other one. Keep using that until that one fails, then switch back.
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services