Creating A Really Simple Web Service For Popfly Consumption


I created a really basic web service that performs an IP geolocation based on the database at http://www.hostip.info. All it does is construct and hydrate a serializable object with string properties based on the IP you pass to it. Be careful because I was pretty lax on error handling this time around (I’m an academic DE, after all… 🙂 )


When I tried consuming it via GET in Popfly (using environment.getXml(…), I tried navigating to my service in a browser. I kept getting access / 404 type errors while trying various combinations of the webservice URL. I then remembered from another blog post on blogs.msdn.com that you have to add HttpGet as a handler in the service’s web.config as shown under <system.web>:


<webServices>


      <protocols>


            <add name=HttpGet/>


</protocols>


</webServices>


Now you can access the IP geolocation service (which I called Locust) either directly via a web reference at http://locust.danwaters.com/locust.asmx or via an HTTP GET (like you’d do in a Popfly block): http://locust.danwaters.com/Locust.asmx/GetLocationByIP?ipAddress=207.46.193.254


The resulting Popfly mashup can be found here. It sticks a pushpin in Live Maps indicating where the IP comes from.


 


 


 

Comments (0)