Not all WMS servers support legends, so you will need to check the services capabilites first. If a legend is supported you can access the symbol swatches for each layer to construct the legend yourself.
How did you add in the URL legend in the Legend widget Flex code? Have you implemented before? if yes? can you share the code? I am trying to find out how to do it for Flex viewer for ArcGIS 2.5 and 3.6.