Rewrite much of the wsdl parsing logic

The previous wsdl parsing made some assumptions in the name of
simplicity that unfortunately made it very difficult to handle some WSDL
features and sometimes generated unnecessary types.