You should not create webservice to access the IoT Hub. It is designed to hold the data for a short period. You should store the data in some kind of storage solution and then use webservice to fetch data from the storage. Here is a quick suggestion without considering the complexity of your query need. (Different storage solutions perform differently based on your query type, and you will need to verify your query requirement to decide what storage solution works best for you.)
1. Create a Storage Account and Table
2. Create Stream Analytics, set the output to the Table Storage in the new created Storage account, and input the query to pull data into this table
3. Start the Stream Analytics and make sure it runs without error message
4. Download the MS Azure Storage Explorer and verify if you can see the data coming to the table
5. Get SAS by for this Storage account in the AZ Storage Explorer
6. Now you can use the OOB webservice to access the data in this table by using the SAS URL parameter to authenticate. Here is your reference.
Query Entities | Microsoft Docs[
^]