The first script was little mis-leading my mistake, it should have read
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS:remove
Note that under every resource-adapter there can be more than one "connection-factory", it is connection factory that we are trying to replace. Your suggested method will remove all the connection factories underneath this "resource-adapter"