by devjab · 3y ago · 0 comments
You’d have these completely over engineered solutions where you’d basically need to call a separate micro services for every “field” of anything. So if you wanted a name, a ssn, and, an address for a citizen you’d need to make several calls. We ended up buying an API for the APIs, but that is besides the point I’m trying to make. The point is that it was very designed, but the XML. Well… you’d have things like:
<ssn ssn=“123”/><id>123</id> and worse. And it’s like, why would they spend all that time designing micro-service and data architectures and then output really inconsistent and often even standards breaking XML? But I know why, because out of the maybe 300 different systems to output XML that I’ve worked with over the years, none of them did it “right”.
If the future is XML then we better step up our game!
XML the data format is pretty great in its basic form. Not space-efficient, but unless you're dealing with bulk data, the inefficiencies don't matter unless you're googlescale or can't spare a millisecond. The format itself doesn't absolve you from the design work of your model; your ssn example is typical of the "CEO said we have to use XML now" rush-jobs at the peak of the SOA hypecycle.
XML data validation through XSD is a dream. The insistence of the JSON-people to sabotage any kind of data validation is absurd to me.
XML Webservices are easy and consuming them from a WSDL is easy.
SOA on an enterprise level was a stupid idea creating a giant expensive communication middleware with the ESB without delivering on the promises.
Every other thing in the XML space is brainfuck-level overcomplicated bullshit dreamt up by bored enterprise architects. WS-* is a cacophony of overcomplicated solutions to problems that only exist because enterprise architects dreamt of having a single data model that's inter-operable between companies.
I don't understand what you mean by this. JSON supports schemas which can be used to validate input. It's not super advanced, but it's functional.
JSON itself succeeds as a way to represent JavaScript objects but it is far less useful than XML for representing custom types, which are easily enforced through XML Schema.
JSON Schema adds some of this, but it isn't a standard (yet).
It just about works, but it's horrible to write and horrible to maintain. What you can actually do with the validation is surprisingly limited in some forms and the fact that you have to write JSON to write the schema shows just how non-user-friendly JSON is.
A friend told me that she writes JSON schemas in YAML and then uses a build step to downgrade that to JSON for the actual validator. I wish I'd thought of that.
Maybe in theory, but I've never had a WSDL that was actually complete. In the end, it generated stubs of types and clients for me and I still had to do a lot of nonsense. The concept of a WSDL would be nice but in practice I've seen _so_ many people do them poorly and create a bad experience.
In a previous life, I shipped many, many, many APIs that used consumed and/or delivered XML data. We'd ship WSDLs if asked, but it was far easier for customers and from a support perspective for us to use the WSDL to generate API clients ourselves and then add some of the necessary supporting bits like authentication. We'd ship these to customers and it made life easier for everyone, despite the overhead.
That assumes that the XSD is accurate. I'm currently working with a vendor that has probably the worst XML-based API I've ever seen and the XSDs they provide often don't provide 100% coverage and have bad complex type declarations, etc.
Another piece of insanity is the e-TL (elektronisk tinglysning) SOAP service. Getting a non-java client generated is a PITA because of the use of the java Catalog feature. Even after hacking around it by setting up a local webserver and liberal abuse of the host file the generated .net WCF client needed manual fixes in a lot of places.
After doing that your calls still fails. It turns out the service wants the client to tell it which xsd to validate the request against (?!?). Also did I mention that the service expects every request to be signed, even when only reading information - it doesn't do anything to validate the signature though.
Right, but the spec allows for so many different ways of using it, that you end up with lots of variations in how it's done.
I've mulled over these choices myself when trying to come up with a XSD spec, and I wish I could slap that idiot who wrote the last XSD spec around with a large trout (that idiot being past me).
While you can do a lot of weird things with JSON as well, the syntax is more restrictive and naturally leads to fewer variations.
I don't think you understood the meaning of the article. It's talking about how XML was, at the end, a red hearing and not best solutions for everything as it was tooted by the industry.
This is an issue that you will have with every kind of data transfer / representation tech, be it XML, JSON, protobuf, etc. Someone needs to have ownership, someone needs to set a standard, and everyone working on it should stick to that.
The official CPR API you can get all of that information with a single call and I think it returns JSON. I'm not sure when that API was released, but I think it was quite a while ago. There is one for companies as well (CVR API, but technically it's just an Elastic Search query iirc).
[1]: https://pretextbook.org/doc/guide/html/part-author.html
But yes, the public sector suffers from countless different systems that have accumulated over the years. It happens because everything has to go out to a public bid and throughout the times it has been considered anti competitive to built things in-house.
In fact, wasn't Denmark a case study of that? I remember there was someone on HN a while ago, IIRC working in public service of some country in Europe, who posted stories about their constant fighting with a vendor who intentionally makes it very hard to have any kind of integration and data exchange between various administrative branches.
(I've seen variants of that far too many times for it to be a joke.)