Question

I'm looking for a tool to generate a JavaScript stub from a WSDL.

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.

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.

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.

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

Was it helpful?

Solution

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.

OTHER TIPS

Apache CXF has tools that generate JavaScript clients that talk soap.

Actually, any CXF service can have a javascript client autogenerated by doing a get to the URL with ?js appended. (just like ?wsld produces the wsdl) There are command line tools as well, but the dynamic generated stuff is kind of neat.

It would probably be an overkill, but NetBeans has this feature.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top