I'm using Andrew Fawcett's legendary [Apex Wrapper Salesforce Metadata API][1] in several projects. It perfectly works and provides a new dimension of APEX programming. Now there are situations where it would be more convenient to access Metadata API via JavaScript instead of APEX.

This is the case for projects, where the heavy lifting part of the logic is already JavaScript and an additional round-trip to APEX is making things more complicated. Especially with asynchronous functions and repetitive queries for completion the ping-pong between JS and APEX is hard-to-read and hard-to-maintain.

The only official JS wrapper I'm aware of is http://www.salesforce.com/us/developer/docs/ajax/ 

However it's possible to create a SOAP string and use XMLHttpRequest or $.ajax() to make the callout. Works fine.

To create the SOAP string I'm following the suggestions [here][2] and use [SoapUI][3] - which is free and really a smart tool. 

My first question: is there a tool similar to Wsdl2Apex which converts entire WSDL to Javascript and works with the challenges of metadata.wsdl? (polymorphic, etc.)

Looking ahead, I would end up in rewriting many functions (or all). I'm now just wondering if I'm the first one who needs it or if there is already something existent? If there is nothing, I would also like to collaborate in a new project - just in case if others would be interested in such a JS wrapper, too.

The same need finally also applies to Tooling API. 


  [1]: https://github.com/financialforcedev/apex-mdapi/blob/master/README.markdown
  [2]: http://salesforce.stackexchange.com/questions/60510/how-to-create-httprequest-body-as-plain-string-from-wsdl
  [3]: http://sourceforge.net/projects/soapui/files/