<p>I'm looking for a tool to generate a JavaScript stub from a WSDL.</p>

<p>Although I usually prefer to use REST services with JSON or XML, there are some tools I am currently integrating that works only using SOAP.</p>

<p>I already created a first version of the client in JavaScript but I'm parsing the SOAP envelope by hand and I doubt that my code can survive a service upgrade for example, seeing how complex the SOAP envelope specification is.</p>

<p>So is there any tool to automatically generate fully SOAP compliant stubs for JavaScript from the WSDL so I can be more confident on the future of my client code.</p>

<p>More: The web service I try to use is RPC encoded, not document literal.</p>

I had to do this myself in the past and I found this
CodeProject article
.  I changed it up some, but it gave me a good foundation to implement everything I needed.  One of the main features it already has is generating the SOAP client based off the WSDL.  It also has built in caching of the WSDL for multiple calls.
This article also has a custom implementation of XmlHttpRequest for Ajax calls.  This is the part that I didn't use.  During that time, I think I was using
Prototype
javascript library and modified the code in this article to use it's Ajax functions instead.  I just felt more comfortable using Prototype for the ajax calls, because it was widely used and had been tested on all the browsers.