This might not be relevant right now but you may find it useful in the near future. I'm tinkering with an app that spits out documentation for an org. I really hate doing documentation and am quite lazy so I thought I'd write something to allow my computer to do my work for me.

I ran into a small issue when trying to compile the Metadata WSDL with the Force.com Web Services Connector so I thought I'd post my fix.

So to use the Metadata API with the WSC, first download the Metadata WSDL from your org and the latest WSC jar from the project. Now issue something like the following to generate the stub code from the WSDL:

java -classpath wsc-19.jar com.sforce.ws.tools.wsdlc metadata.wsdl metadata.jar

Unfortunately this results in an error similar to:

-dir/com/sforce/soap/metadata/Encoding.java:12: '} ' expected UTF-8,

The error is thrown because the WSDL contains some hyphens that is making the compiler puke. You can fix the issue by replacing the hyphens in the Metadata WSDL with underscores, saving the WSDL and then compiling the stub code again.