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

Documentation:

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.

Code:

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. 🙂

License:

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 weblogs.java.net on a post titled Bumper Crop of WADL Tools

List of useful Python libraries

If you are a .NET programmer, then you find Python a bit tough. Reason? Python does not include library for each and every operation possible in this world. You may have to work around to find the necessary packages, download them and continue with your development.

Python’s standard module list has a finite number of entries as opposed to .NET    ( I use .NET at my workplace). Here this is an attempt to collect all such libraries which are outside standard modules, which you might badly need for your development. Many of them are extensions or wrapper packages for already existing libraries.

1 ) scapy

This is a library for  TCP/IP stack wherein you can have full control over the lowest detail of the Packet that leaves your computer. It supports many protocols like ETH, IP, ARP, ICMP, TCP, UDP etc. You can create custom TCP/IP packet and send it to any host. Typical implementation is ARP Ping, ICMP Ping.

Experience: Tried. Works perfectly. Havn’t stumbled across any bugs as of now.

2) soaplib

Used for creating lightweight web services. As the page says, it comes with a client and server built in and on-demand WSDL generation.

Experience: Havn’t tried. Heard about it’s existence.

3) mysql

Uh? Do I really have to tell what this is actually. I hope everyone knows.

Documentation for python-mysql

Experience: Obviously! Obviously! I think I should remove this line.

4) aubio

Stating directly from it’s site – “aubio is a library for audio labelling. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio. The name aubio comes from ‘audio’ with a typo”

Experience: None. Presently in To-Do List.

5) Beautiful Soup

BeautifulSoup is an SGML parser which is highly robust and doesn’t die straight-off even if you give it poorly formed data. To make it scream and die all you have to do is to give something that isn’t SGML at all. It even has a parser class named BeautifulSOAP which is used to parse SOAP message (as the name applies). It even has a class named ICantBelieveItsBeautifulSoup. Sounds stupid? Who cares as long as it does it work.

Experience: Tried when I saw Anomit using it. Need more experience as I have lost touch as of now. Never tried BeautifulSOAP.

6) python-clamav

It is pending in my To-Do list. Will start working as I get time.  Check a small tutorial

Experience: No! Read the line above.

7) python-crypto

Presently in #1 position of To-Do list. Sounds just too promising. Hope it is as I thought it to be.

Check the API and it’s general overview

Experience: No

8 ) django

Now if you don’t know django – Go shoot yourself or read about it here if you somehow survive.

[ As pointed by Anomit, it isnt a framework, but library is a general name I have used for the title ]

Experience: Obviously!

9) gd

I have used GD a lot in PHP, but hardly on Python. GD is simpler than ImageMagik (never used) as people told me. Hope to use this library if I ever require.

If you ever require the documentation, head yourself to this page.

Experience: Not used in Python, but in PHP

10) gmp

GMP stands for GMP Multi Precision and gmpy is a python wrapper over it. Though you might not need it in Python, but if you are coming from C background, this might be a familiar name.

Experience: Normal, not an expert

11) python-jabber

Python-Jabber is a python module which implements jabber instant messaging protocol. Check out the documentation and a funny example .

Experience: Little experience. Not much. After all it doesn’t look so tough, so will sit down for a hacking session,

12) python-irclib

I encountered this library when I was searching more on python-jabber library. This also falls in the category of real-time messaging. The problem I can see is that there is no documentation. How to proceed? Use dir() and inspect module extensively?

Experience: Kidding? Please show me the documentation. I don’t have more time for hacks as I did with scapy.

Till now ,I had kept this list for my own reference. Many more required libraries are missing. If you have any more in mind, please mention it. I would be glad to add it.