Applications integrating software with a large number of physical objects and devices in a large-scale Internet of Things (IoT) networks are on the rise. Some examples of these applications are smart grids and water networks and intelligent transportation systems. As they operate in and control a large heterogeneous environment, these applications need real-time controls, powerful and scalable data storage and processing capabilities, and advanced data analytics mechanisms. One of the promising technologies to support such applications is the Cloud of Things (CoT). CoT can provide a platform for linking an IoT with Cloud Computing (CC). Another technology that can be utilized for enhancing IoT applications is Fog Computing, which extends the traditional Cloud Computing paradigm to the edge of the network to enable better support for operating enhanced services closer to the physical environment. However, proper integration and efficient utilization of CoT and Fog Computing for large-scale IoT applications is not an easy task. This paper proposes a service-oriented middleware, called CoTWare, to facilitate effective integration and utilization of CoT and Fog Computing for large-scale IoT applications.