A framework for safe composition of heterogeneous SOA services in a pervasive computing environment with resource constraints