Introducing WADL#

Of late I have been working on a small project which deals with C# code generation. I named it WADL# by the way most of the C#/.NET projects are names. If Apple products can start with i , GNOME with g, KDE with K and Windows with Win , then  I think WADL# is an apt name.

For all the people who have been working on .NET and web-services must be diving deep into SOAP based web-services. Right? How many of you know that SOAP based web services are not the only type of web-service which exist on this planet? How many of you have heard about RESTful web services? I know the fight between SOAP and REST is just like Emacs v/s Vim and GNOME v/s KDE and SQL v/s NoSQL. If someone worked on SOAP based web service, they must be familiar with WSDL. They added a “Web reference” and voila – Your IDE generated the client proxy for you.

For people in the RESTful world, don’t have something called WSDL. Sun came up with something called WADL. It is again a XML based representation of operations offered by the web-service. WADL doesn’t get so much of love since RESTful people are opposed to anything such as WADL. Whatever may be the case, WADL is still pending with W3C and not yet finalized. This makes the situation more complex for people from WSDL background who have been in a habit of getting their client proxy code. Hardly anyone looks at the actual XML. Why does it make the life tough? This is because I along with many people could not find any such code generators for WADL. After days of hunting I finally gave up.

I actually needed the WADL -> C# code generator as I wanted to write a client side proxy for Launchpad. After figuring out that LP provides a WADL, I started researching how to use it, but only in vain since no such code generators exist. This inspired me to write one of my own. I got the WADL schema, read the reference, sent some mails to launchpad-dev mailing list asking for clarification and finally came up with v0.1 of WADL#, download the assembly file.

I am still learning WADL and not everything is clear. There are many conflicts which might take time to grasp, but the current assembly works flawlessly for Launchpad WADL. Let me know if it fails for some WADL file which you provided. Take the pains to mail me the WADL file too. My email is mail at manishsinha dot net


This is no magic or rocket science. All you need to do it to call the Convert method of WadlConverter which implements IConverter interface. This means you need to use LpNet.WadlSharp.Common.WadlConverter class and call it’s Convert method. The signature of the method is

void Convert(string inputFileName, string outputFileName, string rootNamespace)

The explanation of the method:

  1. The first argument is the filename of the WADL file.
  2. Second argument is the filename of the .cs file. If the file does not exist, it would be created. If it does exist, it would be truncated and then overwritten.
  3. The third parameter is the name of the namespace which you would like the generated code to have.

Languages Supported:

WADL# uses CodeDom which is provided both in .NET and also Mono. WADL# can theoretically gen rate code for all languages which CodeDom can.

In reality, there is a small problem in the file Customizer.cs at line 215 where there is a hard coding for C#. Next release of WADL# will remove that.


WADL# uses Launchpad for development using the Bzr source control system. Get the code from trunk, make changes, push it and add it to merge queue. I love contribution and patches. 🙂


WADL# is an open-source project released under MIT/X11/Expat License. This means you can use it freely any way you like it provided you do not remove the Copyright notice. Know more about MIT License.

Just now I got a mail from Softpedia informing me that they have added WADL# to their repository of Linux Softwares.

Please don’t start with Mono and patents talk. Please point your browser to Slashdot, Hacker News, OSNews and Reddit for such discussions. You’ll get better responses in such places.

Please let me know if there is any mistakes on this post which includes typos, grammatical and factual ones. I would correct it at the earliest.

Update: I just got a backlink from a blog at on a post titled Bumper Crop of WADL Tools

13 thoughts on “Introducing WADL#

  1. Very nice idea.

    I admit I’m from the SOAP side of the great devide, but as I do occasionally come across RESTful services I rather like the WADL idea (it means I can use SOAPui with virtually anything if nothing else). Nice to be able to add auto code generation to that.

    1. Well James, WADL concept hasn’t been well received by RESTful advocates.

      Here is a stackoverflow question:

      To describe restful we can say Every resource has its own URI. Using HTTP GET,POST,PUT,DELETE we can parse these resources. All the resources are representational. Who wants to use our resources, can just use it from browser. that’s all the main idea of restful. This architecture or architectural style allow services on the internet. So why this architecture needs Wadl. What does WADL do and HTTP doesn’t? why there is WADL?

      And the accepted answer is:

      WADL sucks – stop reading about it and move on. There’s a reason it hasn’t really caught on

  2. I probably cannot share the wadl with you, but the code is broken.

    private void button1_Click(object sender, EventArgs e)
    string Filename = “test.wadl”;
    LpNet.WadlSharp.Common.WadlConverter conv = new LpNet.WadlSharp.Common.WadlConverter();
    conv.Convert(Filename, Filename + “.cs”, “test.Api”);

    System.NullReferenceException was unhandled
    Message=”Object reference not set to an instance of an object.”
    at LpNet.WadlSharp.Common.Generator.LpNamespace.Create(application app, String namespaceName)
    at LpNet.WadlSharp.Common.WadlConverter.Convert(String inputFileName, String outputFileName, String rootNamespace)
    at wadl.Form1.button1_Click(Object sender, EventArgs e) in C:\p4\sandbox\JSprenkle\wadl\Form1.cs:line 24
    at System.Windows.Forms.Control.OnClick(EventArgs e)

    1. Jay,

      Unless I get the WADL file, it would be pretty much difficult to fix it. Can you provide me a dummy WADL on the same lines of your original WADL so that I can find it out.

      Well this release has been tested with Launchpad’s WADL. It worked like a charm with that. Can you run it again and find which line of which file throws an exception?

  3. Planning on adding xsd support? The wadl I’m trying to use only has stubs of the service calls, and the actual definitions (and support classes) are all in the xsd. Don’t know if xsd schema differs from wsdl to wadl… would make it easy for you to include it if they’re the same. Good start though. Thanks

  4. LpNet.WadlSharp.Common.WadlConverter cv = new LpNet.WadlSharp.Common.WadlConverter();

    doesnt work.. tested it on multiple wadl files…. same object error as “Jay”.. forget this one.. i think its a dead project… no help, no response, no new versions.

    1. bloom, As I said, without more WADL files I cannot improve this project. Right now I have only one and only one WADL file – Launchpad’s.

      I have tested and this code works on Launchpad’s WADL file, so unless the WADL file which breaks the code is provided, it would be really tough for me to figure out what all kinds of problems are there.

      Just for your information, WADL is itself a broken technology. I had created this project so that people who use WADL can atleast have some peace of mind, but it looks like it would be really tough to fix WADLsharp without more sample WADL files

      1. Hi,

        Firstly, thanks for the great tool Manish! 🙂

        I too faced this problem that Jay had; It was caused because he wasn’t passing in a codeSerializer to the WadlConverter object. Perhaps this should have been specified as a parameter in the Convert method to make it more obvious that it requires it to function properly? 🙂


  5. Hey nice weblog, simply checking out some sites, appears a a very nice theme you are using. I’m presently using Drupal for a few of my sites but seeking to switch one of them over to a look very much like yours as a test site.

  6. Hey,
    Is the WADL converting working i see that this post was active long back. I have few wadl file which i want to convert but i am facing soem issues with that. Would need help on this.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s