Please drop the SOAP
thecoffman.com
thecoffman.com
It was initially sold that way, but that was just the first of a parade of sales pitches, hilariously chronicled here, http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-... --- endlessly shifting as if seen through a fun-house mirror.
soapUI is an application that will let you fiddle around until you get the calls right.
I recently did exactly this. I wound up not only generating the SOAP envelope by hand but also the HTTP headers:
SOAPAction: "http://...//SubmitDataform
What is the action I am trying to do doing in the HTTP headers?
You are vastly oversimplifying when you say "with REST you just have to figure out a URL". Try integrating with a service that takes only custom HTTP verbs with multipart/form-data but because there's no standard way to send an array in HTTP you have to append some parameter multiple times but in the right order. There's some vague attempt at using OAuth for authentication, but it doesn't work with any of the libraries you are used to. Oh, and the service returns a 503 some of the time, which (according to the rambling hacked up docs for this API) means you should retry your request in 10 seconds. No, it's not always trivial.
I thought it was discoverability which was SOAP's strong point, while ad-hoc solutions like REST which have the bonus of being much more lightweight/terse, lacks this feature.
As for non-standard query-format, with a good toolkit you point to the WSDL and you are done, all your RPC-calls pregenerated for you.
I know SOAP has some issues, that it's a verbose line-format and that recent WS*-additions add complexity faster than you can say "oh shit", but at its root, SOAP really isn't hard to work with if you have a decent toolkit.
If you are hand-rolling your SOAP-layer, you might as well start invoking your database trough telnet and handrolled protocol-code. It makes as much sense.
As to the existence of sufficiently good toolkits, that won't save you in the face of vendor bone-headedness. Talking to .NET from a Java stack is still problematic, where either toolkit on its own is apparently fine on its own territory. There's a particularly fine example in MS Exchange Web Services, where getting Java to talk to it over SOAP is so fiddly they're releasing a Java port of their managed API.
You have the SOAP messages which envelopes (sigh) yet another message-level architecture where every request, even at OO level means constructing request-objects with millions of sub-properties, all types fitting an abstract inheritance tree. Which ofcourse is also what you get returned after sending your request. So then you have to start analyzing your response object (again a message-object enveloped in a SOAP-message) and anaylze what class it actually is and the same for all subproperties.
I don't mind SOAP so much, but EWS can really go die in a fire. You can say whatever you want about SOAP in general, but EWS cannot really be used as an example of anything other than itself. I've never seen such a painful and convoluted solution anywhere else.
Even if SOAP had been ditched and the wire-format used had been some sort of RESTFul implementation, it would still be a clusterfuck to use. Blaming SOAP here is IMO a bit misdirected.
Anybody that tries to interface with a SOAP interface by writing envelopes by hand is wasting their time and half-implementing the (long, terrible, complicated, blah blah) spec.
Find a good toolkit. Yes, the protocol is way over engineered but good tools can and do abstract that all from you. For instance, PHP's standard library lets you plug in a WSDL URL and consume SOAP services in two lines of code. (And because it is a good toolkit, it lets you spit out all traffic with one debug flag, unlike whatever terrible thing the author of this article is using.)
Most of what people complain about in these comments would be moot with good tools. You would probably complain about REST if you didn't have curl or Firebug and had to telnet all your test calls--that's equivalent to what most people here seem to be doing.
The reason people are writing their own envelopes in cases (like I did also) is because the tooling is not delivering up to it's promises. (Let alone that the server might not even understand the two-line-code genertated nusoap reponse because he interpretes some ws-* rules about namespaces differently.
The conclusion is: nobody wants to write his/her own envelopes.
I don't know anything about .NET, but I wonder if there is something profoundly different that is going on behind the scenes, or does it just generate crufty WSDLs? Can anyone shine more light on this?
The going gets rough when people put half their strongly typed domain logic in the wsdl which has to be recereated on the other side. Hint: Collections != Arrays != Hashes
So, problaby not .NET but bloat related. Interoperability is a problem on all sides though.
I'm investigating 3 different WSDL->JS libraries.
* Guru4 JavaSriptSOAPClient - Unmaintained since 2006
* Python wsdl2js - not widely tested or maintained
* Apache CXF wsdl2js - maintained, but doesn't seem to like the WSDL provided by my service provider.
Of the three, Apache CXF is the only one that looks promising, but fails to generate any JS. I'm trying to fix it, but I keep encountering more old-style web-services acronyms. All I want are so classes - maybe I'm doing something wrong, but I simply don't think it should be this hard.
If you're interested, the WSDL issues are detailed further in http://stackoverflow.com/questions/4827467/understanding-apa...
Edit: I've found a maintained version of the Guru4 implementation at http://javascriptsoapclient.codeplex.com that I'm going to try.
Trying to generate code using a Java toolkit from an MS wsdl? 90% chances of failure. Same the other way around.
A protocol for interoperability that is vendor-specific? That's an oxymoron.
I spent a few weeks trying to find a good toolkit for the big hairy nested ape of a WSDL I was trying to consume, and nothing could parse it properly and expose the methods in a sane manner.
I ended up doing just what the OP did - hand-crafted the request payloads in soapUI and turned them into templates that I could execute programmatically.
I really hate SOAP.
> WSDL
In the OPs defense, it should be pointed out that SOAPUI is a WSDL client.
Sure, if I'd write in Java (I ended up with Perl5, as - thanks to CPAN - it seemed the most suitable for the task), all this SOAP stuff would be as simple as several clicks in NetBeans or whatever-Java-people-are-using. But I didn't knew Java enough to write everything I needed, I didn't like idea of Java SOAP-to-SomethingRESTful proxy, and I was quite scared of FactoryFactoryFactoryInterfaceActorProducerFactoryFactorySingleton libraries to dive into Java (yes, I know not all Java is Enterprise Quality, but system I had to interface with was extremly enterprisey).
For tiny one-API-call tasks, I'd much rather use a JSON REST API that I completely understand. When I'm trying to interface with a complicated system that has a million different objects, I'd rather spend an hour figuring out the tools, then rely on generated code so I can take advantage of IDE auto-completion instead of digging through the documentation to remember the params and return value. It's the in-between of these two cases that's the devil, especially since big nasty APIs always start out small and simple.
http://www.owasp.org/index.php/Generating_Custom_SSL_Certifi...
The super annoying thing is worrying about WSDL, XML namespaces and xpath for something as simple as getting a count of alerts.
In JS, you have no client library so you're required to roll everything from scratch.
PHP has oauth, more demo code and better docs, I've recently been using it to build a JS lib for a work project.
The thing is, rather than maintain one client library, half maintain two others, and have a bunch of unofficial libraries, if they just made and documented a REST interface everyones lives would be easier.
Big problem is at the moment that PHP has Oauth for pretty much everything except report downloading, which is essentially separate from the rest of the API.
Hoping they fix this before I launch, as most of the good of OAuth is negated if I still have to collect a username and password for report downloading.
"For starters you have to point Visual Studio (sigh) to the service reference, at which point nine thousand (yes, that’s nine-zero-zero-zero) lines of code are generated."
"Not a descriptive error, or an HTTP status code, or anything that could be used to track down the problem but a “SOAP Error.”"
"Long story short, in order to inspect SOAP messages you have to write a class that implements the ICLientMessageInspector interface."
These are supposed to be problems with SOAP? To me they look like a crappy implementation.
The conclusion is also crappy:
"In my mind SOAP’s biggest failure is what some people consider to be its biggest success – it abstracts away all notion of the underlying HTTP model and replaces it with crutches like code generation."
Jeez, man - SOAP has problems, but code generation!? It's not a problem with SOAP but with the way your environment integrates with SOAP. Code generation over any protocol would create the same problems and there's nothing about SOAP that makes code gen inevitable.
Sorry I don't agree.
Firefox for example hides the protocol details. You don't need to know DNS, TCP/IP, HTTP to browse the web.
It's the same for SOAP. If with "hide the protocol details" you refer to this part of the post
"I got an error. Not a descriptive error, or an HTTP status code, or anything that could be used to track down the problem but a “SOAP Error.”"
you may not be aware that the SOAP specification has SOAP exceptions. And they are actually quite easy:
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Please specify your birth date</faultstring>
</soap:Fault>He just used a bad SOAP api that returned an useless error.
There are many other things about SOAP we can hate and that need to be fixed, but in this particular case SOAP is not at fault, and REST could very well be exactly as bad.
> Firefox for example hides the protocol details. You don't need to know DNS, TCP/IP, HTTP to browse the web.
I don't think that example supports your argument. Quite the reverse, in fact. Firefox doesn't hide that much of the details. You can still see the gory details of URLs and HTTP requests surfaced quite clearly, and the experience of using the web is that much richer if you know what they are and how to manipulate them. Firefox doesn't actively prevent you from doing so if you want to, which it would if it was trying to present a sealed abstraction.
As regards errors and error reporting, I don't particularly want to get into REST v SOAP, because that's tired ground that's been trodden a thousand times over. However, REST has an advantage over SOAP here in that it uses HTTP error codes. An app which returned a 200 response when it couldn't find something would never be described as RESTful, whereas a SOAP app can get away with anything as an error response. It's simply not possible for a REST API to be bad in that sense where it demonstrably is for SOAP.
Contrast with IEs 'friendly' error messages by default. Instead of an easily diagnosed 'page not found', or 'address not found', or 'server error' you get 'something went wrong' and then a list of always incorrect guesses as to what the problem might be and a confusing list of irrelevant things you can try to 'fix' the problem. I bet somebody got a bonus for that feature.
That said, SOAP really is more complex than it needs to be. What makes it worse the ironic name : "SIMPLE object access protocol".
But the last three SOAP services I had to swallow ..err.. consume, leaked their abstraction over my desk and I had to start to xpath my way through responses from a Java service after having curl'ed my handwritten requests to the other side. This was not due to a problem with the published API but with the protocol annoyances as such. (e.g.: your OrderClass is not my order_class and your Array() is not my [] )
So you actually used SOAP like REST with XML :)
How to discover the meaning of data in the absence of a WSDL/RESTDL? Will we have microformats with links pointing to ontology-servers? Wat if its JSON?
I wonder what REST looks like five years from now, when for instance, IBM and M$ become involved in a standardization process ...
If you don't need to interop with existing systems that use SOAP, then sure, a REST style makes sense.
Once you know the secret platform handshake these enterprise tools are pretty easy.
Edit: fix annoying iOS auto-correction.
http://php.net/manual/en/book.soap.php
I've implemented both servers and clients using SOAP with low to no hassles.
Bad implementation != bad specEmbarrassing - despite my best efforts it appears as if my little linode couldn't handle being frontpaged - here's a cached entry for now:
http://webcache.googleusercontent.com/search?q=cache:UehgGNU...
The blog entry is cached as a static page hourly and served via nginx as such - this load shouldn't have killed it. Will be interesting to dive into.