GeekFest #6 - WebApiProxy Update
Friday, January 30, 2015
It's been a long wait but the time has finally come for more interesting features on WebApiProxy. This video briefly outlines some of the many great features that were added to WebApiProxy in the past couple of months.
You can read more on this project by going to this introductory blog post or at my recent blog about the update.
You can follow and contribute to the project on GitHub here
Labels:
ASP.NET Web API,
GeekFest,
GitHub,
MEX,
WebApiProxy
An update on WebApiProxy
Saturday, January 24, 2015
This project initially started as a proof of concept but quickly grew into something very useful. For the past year or so it became quite popular and plenty of bugs came out of the cracks, but also useful feedback for features too!
You can download the packages straight from NuGet: WebApiProxy Provider and Web API C# Proxy Generator
You can download the packages straight from NuGet: WebApiProxy Provider and Web API C# Proxy Generator
Release notes
Here are a quick summary of issues resolved and features introduced in the latest version:
WebApiProxy Provider (version 1.0.2.4)
- OWIN support and compatible with self-hosted Web APIs
- Custom MEX endpoint address
- Enums and Constants support in DTOs
- Support for IHttpActionResult
- Extended documentation on DTOs
- Plenty of bug fixes & refactoring
WebApiProxy C# Generator (version 1.0.3.21)
- PCL compatible
- Generated code now contained inside project
- Opt-in for automatic code generation during build (now disabled by default)
- On-demand code generation using NuGet Package Manager Console
- No more reloading project for unresolved types
- Cleaner config file
Labels:
ASP.NET Web API,
C#,
MEX,
nuget,
Powershell,
Silverlight,
Web Api Proxy,
WebApiProxy,
Xamarin
Fiddling around with XML responses
Tuesday, January 6, 2015
My year started with new challenges, first of which is malformed and unformatted XML. One of the requirements of a new project I'm working on is to read a simple XML response from a web service and do something with the data. How hard could it be?
Like any other developer, debugging tools like Fiddler is my friend. After capturing the response, I noticed that the contents were malformed and not properly formatted, but still "valid" XML.
Viewing the actual raw response, I realized that the apparent XML elements within the root 'string' element where actually encoded literal strings:
After accepting that I can't change the world, but definitely change the way you think about it, I decided to create a helping aid in the form of a Fiddler extension to help me make sense of the so-called XML.
Now we can get coding! Add a new class to the project with the following assembly attribute:
To make this class visible to Fiddler we need to implement the IAutoTample interface and in the AutoTamperResponseBefore function, we can modify the response before it is served to the client.
This will use the provided Session object and replace the XML encoded angle brackets < and > as < and > respectfully. While we at it, I've also decided to brand the response by adding a "Response-Hijacked-By" response header just because we can.
Lastly we need to build the project and copy the DLL to the Fiddler Scripts directory at %programfiles(x86)%\Fiddler2\Scripts\
Note: You may need to restart Fiddler if it was running.
Till next time!
@FanieReynders
Like any other developer, debugging tools like Fiddler is my friend. After capturing the response, I noticed that the contents were malformed and not properly formatted, but still "valid" XML.
Viewing the actual raw response, I realized that the apparent XML elements within the root 'string' element where actually encoded literal strings:
After accepting that I can't change the world, but definitely change the way you think about it, I decided to create a helping aid in the form of a Fiddler extension to help me make sense of the so-called XML.
Creating a Fiddler Extension
The first thing we have to do is create a new class library project in Visual Studio. We are going to target Fiddler version 4, so make sure the .NET target framework is set to 4.0.
Next, we need to add a reference to our project to the Fiddler assembly located at %programfiles(x86)%\Fiddler2\Fiddler.exe:
Now we can get coding! Add a new class to the project with the following assembly attribute:
To make this class visible to Fiddler we need to implement the IAutoTample interface and in the AutoTamperResponseBefore function, we can modify the response before it is served to the client.
This will use the provided Session object and replace the XML encoded angle brackets < and > as < and > respectfully. While we at it, I've also decided to brand the response by adding a "Response-Hijacked-By" response header just because we can.
Lastly we need to build the project and copy the DLL to the Fiddler Scripts directory at %programfiles(x86)%\Fiddler2\Scripts\
Note: You may need to restart Fiddler if it was running.
Testing the goodness
Now when we execute the request, the extension kicks in and alters the response as proper XML:
We even got a special signature:
2014 Rewind: My year in review
Monday, December 29, 2014
About this time last year I started blogging more often and made a decision to spend a little more time giving back to the community and completely re-branded myself to be more efficient in what I do. Oh boy was it a year!
Looking back on 2014 brings back both happy and sad moments, but also life changing events as well. Unlike the other technical articles I've written in the past year, this one will be different and completely dedicated to 2014, my year...
Looking back on 2014 brings back both happy and sad moments, but also life changing events as well. Unlike the other technical articles I've written in the past year, this one will be different and completely dedicated to 2014, my year...
Labels:
2014,
Happy Holidays,
Review
GeekFest #5 - AngleSharp with Florian Rappl
Sunday, November 23, 2014
There are a few good HTML & CSS parsing libraries out there, but AngleSharp definitely stands out among them by giving .NET developers all the same possibilities of modern browsers using JavaScript. In this fifth episode of GeekFest, Florian Rappl takes us through what AngleSharp actually is and why it is not "just another head-less browser". He briefly outlines some impressive performance metrics of this portable class library and takes us through some cool features like built-in CSS parsing and DOM querying.
Although the library hasn't reached it's official 1.0 release yet, it's fully extendable from the get-go and the project is already inviting pull-requests on GitHub. You can also grab it from Nuget.
Please feel free to leave your feedback on the subject. Enjoy.
Although the library hasn't reached it's official 1.0 release yet, it's fully extendable from the get-go and the project is already inviting pull-requests on GitHub. You can also grab it from Nuget.
Please feel free to leave your feedback on the subject. Enjoy.
Labels:
.NET,
AngleSharp,
C#,
CSS,
Florian Rappl,
GeekFest,
HTML5,
Parser
GeekFest #4 - Custom Emmet Snippets
Friday, November 21, 2014
In this episode we briefly see how easy it is to create your own custom HTML snippets for Emmet. I really found this useful and hope this can save someone plenty of time,
Labels:
Emmet,
Extensions,
GeekFest,
Plugins,
Sublime
Break the barriers and tweet longer
Tuesday, November 4, 2014
It's been a while since I found a decent time to post something useful. As the saying goes: There isn't any better time than the present. So while on my way on a super long flight, to rainy Seattle for the MVP Summit, I've got plenty of time to kill. Just wished I had WiFi earlier...
Labels:
azure,
Chrome Extensions,
html,
javascript,
mobile services,
mvc,
Twitter
For the lazy programmer: Using Excel as a code generator
Monday, July 14, 2014
As a 'lazy' programmer, I tend to find creative ways to generate code. One of today's challenges required me to create Enums (each with a description) from code & description pairs of unit measures found inside an Excel spreadsheet containing millions of records (okay I may be exaggerating).
Immediately, my brain started to think about possible solutions like T4 generation or find & replace. Luckily, I remembered I have Excel on my machine. This made things so much easier.
Immediately, my brain started to think about possible solutions like T4 generation or find & replace. Luckily, I remembered I have Excel on my machine. This made things so much easier.
Labels:
code generation,
Excel,
Formula,
Lazy programming,
tip
Setting up continuous integration from GitHub to NuGet using MyGet
Friday, June 13, 2014
It's been a while since my last blog post so I decided to dust of my good ol' Blogger account and get to it. I recently relocated from sunny South Africa to begin my brand new career in the beautiful Netherlands and I must say that I'm absolutely loving it!
My first task was to implement continuous integration on one of the (soon to be) open source projects to deliver packages on NuGet. After finding plenty of resources on the web about TeamCity, AppHarbour and Octopus Deploy, I finally decided on using MyGet which delivers a NuGet-as-a-Service experience.
My first task was to implement continuous integration on one of the (soon to be) open source projects to deliver packages on NuGet. After finding plenty of resources on the web about TeamCity, AppHarbour and Octopus Deploy, I finally decided on using MyGet which delivers a NuGet-as-a-Service experience.
Talking basic F#
Thursday, March 27, 2014
In this episode of GeekFest I talk to F# enthusiast Huw Simpson about the basics of F#. He gives us the run down on why functional programming is becoming the new kid on the block and how easy it is to start learning a new language like F#.
GeekFest #2 - Web API Proxies with WebApiProxy
Sunday, February 16, 2014
In this second installment of GeekFest we explore a little project called WebApiProxy I've been working on that allows us to create WCF-like proxies for ASP.NET Web API in JavaScript and C#
Labels:
ASP.NET Web API,
GeekFest,
Web Api Proxy
Introducing WebApiProxy: Providing JavaScript & C# proxies with Intellisense including documentation for ASP.NET Web API
Thursday, January 16, 2014
WebApiProxy extends your ASP.NET Web API service with a proxy endpoint, providing a ready-to-use JavaScript client as well as metadata, exposing the types used in the service. If you are using the documentation provider from ASP.NET Web API Help Pages, the usage documentation is also included inside the metadata, giving the client-side developer a rich experience with Intellisense.
This release has been updated and includes much more great features. Read more on the update here.
Labels:
ASP.NET Web API,
RESTful,
T4,
Web Api Proxy,
webapi
Clouds in my CoffeeScript
Tuesday, January 7, 2014
The "mystery language" CoffeeScript has been around for about 5 years now and I only recently started to play around in it. Like TypeScript, I must add that it's a bit of a learning curve, but once you get the hang of it, it's smooth sailing from there. I've promised myself to keep this short and sweet, so I decided to write an article about calling a Windows Azure Mobile Service (WAMS) from CoffeeScript.
Labels:
azure,
coffeescript,
javascript
Introducing GeekFest: Screencasts for developers
Monday, January 6, 2014
For quite some time I’ve been meaning to start a video blog (or vlog) on interesting subjects and people so I’ve decided to waste no more time and get to work on a new series called GeekFest, a screencast for developers by developers.
A Windows Phone app from zero to store in 5 easy steps
Saturday, December 28, 2013
For those savvy developers out there, who have great ideas for apps but not enough time to implement it, this comprehensive how-to guide will come in quite handy. The Windows Phone App Studio is an online WYSIWIG app builder designed to get you going in a snap. It allows you to build and test your app in no time for immediate publishing to the Windows Phone Store and share it with others. The great thing about this is that it generates the source code for you, enabling you to do more advanced modifications using Visual Studio. Oh and did I mention it compiles totally native code?
Labels:
App Studio,
Windows Phone
How T4 templates can help you with maintainable multi-page apps in JQM
Friday, December 27, 2013
Labels:
JQuery Mobile,
PhoneGap,
T4
Leverage the power of Twilio from Azure Mobile Services
Saturday, October 19, 2013
Ever wanted to send a simple text message from your web app? Well, now you can by using Twilio - an awesome cloud-powered API for voice calls & text messaging. Okay, I know that statement sounds like something out of an infomercial, but I recently had a simple need to send text messages from Windows Azure Mobile Services (WAMS), and after a bit of research, I came across Twilio which allows me to do just that.
Using Twilio from within WAMS can be quite tricky at first, but after a few practise rounds, I finally got the hang of it and realized that its actually very simple and easy to use, so I decided to write about how Twilio and WAMS together can solve a simple real-world scenario.
Using Twilio from within WAMS can be quite tricky at first, but after a few practise rounds, I finally got the hang of it and realized that its actually very simple and easy to use, so I decided to write about how Twilio and WAMS together can solve a simple real-world scenario.
Labels:
azure,
GitHub,
mobile services,
Nodejs,
Pay it forward,
SMS,
Text message,
Twilio
How RESTful is your service?
Monday, September 9, 2013
Web services are everywhere these days, from social media platforms to enterprise line-of-business solutions. It is extremely important to be able to expose APIs for your solution, in order to reach more external consumers on multiple platforms. As a modern trend, we see that more and more APIs are surfacing claiming to be RESTful, but in fact, they're actually just good old remote procedure calls (RPC).
Many of these proclaimed "REST"-style services are implemented not even knowing what the term means, so I've decided to help try explain REST and how to get your services RESTful.
Many of these proclaimed "REST"-style services are implemented not even knowing what the term means, so I've decided to help try explain REST and how to get your services RESTful.
Labels:
ASP.NET Web API,
HTTP,
http services,
RCP,
rest,
RESTful,
RESTful constraints,
Roy Fielding
Using the Twitter REST API v1.1 from Azure Mobile Services
Thursday, June 20, 2013
Since the retirement of the Twitter REST API v1, I have been having trouble doing a simple query using the new search API introduced in version 1.1 from Azure Mobile Services because it now requires a signed authentication header in the request using the OAuth 1.0 protocol.
I would suggest reading the tutorial on Schedule recurring jobs in Mobile Services which provides a basic walk through on creating a scheduled job in Azure Mobile Services that requests tweets from Twitter and stores it in a table. The reason you should read this tutorial is to gain some background knowledge on the concept for better understanding of my newly devised method of use.
The problem with the [out-dated] tutorial mentioned above is that it still uses version 1 of the recently depreciated Twitter REST API.
After plenty of research (and failed attempts) on properly signing the request to have Twitter authenticate it using custom code, I realised that Azure Mobile Services is hosted by a NodeJs process and learned that the 'Request'-object comes out-of-the-box with OAuth support.
I would suggest reading the tutorial on Schedule recurring jobs in Mobile Services which provides a basic walk through on creating a scheduled job in Azure Mobile Services that requests tweets from Twitter and stores it in a table. The reason you should read this tutorial is to gain some background knowledge on the concept for better understanding of my newly devised method of use.
The problem with the [out-dated] tutorial mentioned above is that it still uses version 1 of the recently depreciated Twitter REST API.
Current (old) approach
Here's the code for the scheduler borrowed from the [current] tutorial:After plenty of research (and failed attempts) on properly signing the request to have Twitter authenticate it using custom code, I realised that Azure Mobile Services is hosted by a NodeJs process and learned that the 'Request'-object comes out-of-the-box with OAuth support.
New (updated) approach
By simply assigning the application's keys and tokens to the OAuth property of the request, it worked like a charm:Do take note
There are some breaking changes to the API therefor I strongly recommend studying the Twitter API 1.1 documentation. Some of the other changes I had to make to the original code include changing the expected response body property 'results' to 'statuses' as well as the mapping to the.'update' object.
I hope that this saves someone out there somewhere a lot of trouble and time.
Your comments and tweets are welcome. @FanieReynders.
Till next time!
Labels:
azure,
mobile services,
twitter api
ASP.NET Web API <#= Proxy to T4 #>
Sunday, March 10, 2013
One of the coolest new features of ASP.NET is Web API, which allows you to build powerful RESTful services exposed over HTTP. HTTP is not just for serving up web pages, but it provides a platform for building APIs that expose services and data. It is simple, flexible, and ubiquitous.
ASP.NET Web API is all aboutREST HTTP Services. Unlike Web Services, it does not expose an end-point for meta-data exchange. When consuming a HTTP Service, you will have to create your own client-side code that must serve as a proxy for interfacing with the API.
Like any other WCF junkie out there, I've been working with Windows Communication Foundation for quite some time now implementing Web Services. Not only is it flexible and extensible, but it offers inter-operability, multiple message patterns, transactions and meta-data exchange etc.
The nice thing about WCF is meta-data exchange, which allows you to generate the client-side proxy-code, contracts and classes used for talking to the service. On the other hand, ASP.NET Web API is more light-weight, operates only via HTTP and is used more for serving CRUD-based operations. The latter, however, does not have functionality (yet) for exposing service meta-data. Until now...
ASP.NET Web API is all about
Like any other WCF junkie out there, I've been working with Windows Communication Foundation for quite some time now implementing Web Services. Not only is it flexible and extensible, but it offers inter-operability, multiple message patterns, transactions and meta-data exchange etc.
The nice thing about WCF is meta-data exchange, which allows you to generate the client-side proxy-code, contracts and classes used for talking to the service. On the other hand, ASP.NET Web API is more light-weight, operates only via HTTP and is used more for serving CRUD-based operations. The latter, however, does not have functionality (yet) for exposing service meta-data. Until now...
Labels:
aspnet,
http services,
rest,
webapi
Subscribe to:
Posts (Atom)







