by jmillikin · 4y ago · 0 comments
* Incredibly verbose. Even a trivial array value like [1, 2, 3] encodes to over a hundred bytes. I'm convinced the author was not aware of attributes, or for some reason held a grudge against them.
* There's only like five primitive types, so implementations that want to transmit wild and unusual values such as 64-bit integers need to define their own ad-hoc extensions.
* It's written in XML but there's no namespace, and implementations may or may not use namespaces for their extensions. Is an int64 represented as `i8` or `{http://ws.apache.org/xmlrpc/namespaces/extensions}i8`? Depends on which library you're talking to!
* There's a native "date/time" type, but the syntax is unspecified other than being ISO8601-ish. Don't even get me started on timezones, which will probably be in the local time of the server, but might be in UTC or BST or who knows what.
* The XML-RPC spec claims that <string> elements can be used to transmit any character except '<' and '&', including binary data, including NUL. I want you to imagine what that looks like on the decoding end. Your XML parser is just humming along, decoding UTF-8 and lexing some tags, and all the sudden it comes across a big blob of fucking binary data in the middle of the document. Why was this allowed when the spec also defines a <base64> element??
The XML-RPC spec ought to come with a Surgeon General's warning that reading it might give you brain worms.
That is completely unsurprising, attributes suck ass for data, what would XML-RPC even have used them for? Replacing <int> by <integer width=“32”>?
Other serialisation formats make the same choice (e.g. plists) because it’s so much simpler.
> There's only like five primitive types, so implementations that want to transmit wild and unusual values such as 64-bit integers need to define their own ad-hoc extensions.
An issue which, which very much unfortunate, is not exactly shocking. Json would have the same if it had integers in the first place.
> including binary data, including NUL
Nul is a perfectly valid UTF8 character.
> That is completely unsurprising, attributes suck ass for data,
> what would XML-RPC even have used them for?
Instead of this: <struct>
<member>
<name>faultCode</name>
<value><int>-123</int></value>
</member>
<member>
<name>faultString</name>
<value><string>some fault</string></value>
</member>
</struct>
It could have been: <struct>
<member name="faultCode"><int>-123</int></member>
<member name="faultString"><string>some fault</string></member>
</struct>
or even: <struct>
<int name="faultCode">-123</int>
<string name="faultString">some fault</string>
</struct>
-- > An issue which, which very much unfortunate, is not exactly shocking.
> Json would have the same if it had integers in the first place.
XDR (used in Sun RPC) was defined in the '80s and had 64-bit integers. The DEC Alpha line had been out for 5 years or so when XML-RPC was published. It's not like 64-bit integers were unusual at the time. > Nul is a perfectly valid UTF8 character.
NUL is not permitted in XML documents. The XML-RPC spec's explicit directive to allow NUL puts it at odds with standards-conforming XML parsers. <array>
<dict>
<key>CFBundleTypeName</key>
<string>ShapeEditDocument</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.example.shape-doc</string>
</array>
</dict>
</array>
( Taken from[2] )Maybe it's common to design XML schema like this at that time?
[1] https://en.wikipedia.org/wiki/Property_list
[2] https://github.com/robovm/apple-ios-samples/blob/1f6b14ef6e2...
Also, messages that look like a HTML web page at the time also could have made it seemingly easier for developers to work with, and be attracted to use a new platform.
I may be dating myself here, but a lot of folks new to the industry seem to think of anything pre-2000 as a dark time full of greyscale CRTs and dot-matrix printers. While those did exist in the home market, academic and business computing (where most of the advanced tech was being developed) was pretty advanced and a modern engineer would have felt right at home on a mid-90s UNIX workstation.
If you go back further you'll start encountering things like CORBA, which were pretty bad, but had the legitimate excuse of being very early. Remember that the '90s moved fast by modern standards -- CORBA was contemporary with MS-DOS, while XML-RPC was after IE had dethroned Netscape.
[0] https://www.xml.com/pub/a/ws/2001/04/04/soap.html
[1] https://docs.microsoft.com/en-us/previous-versions/technet-m...
The rationale probably being to enable storing XML content in zero-terminated C strings.
SOAP was basically XML-RPC++, with namespaces, 4 part harmony, and 8x10 color glossy photographs. It's the codification of XML-RPC adding all of those XML features, data types, and interface definitions. It's also a miracle if there's any interop between different stacks.
I had the "pleasure" of dealing with a few SOAP web services a few times. That stuff was just completely horrible and unusable.
HTML5 became a thing when W3C began insisting that XHTML should be a thing, complete with namespaces and other nonsense. That was peak XML basically. Developers rejected it. Browser vendors and content creators basically stepped in and fixed HTML and CSS properly because w3c could not be bothered to step over the semantics and actually define how that stuff was supposed to behave in the real world (i.e. specifiying the semantics of their semantic HTML).
Come to think about it, there was a whole bunch of things that came out of w3c that essentially was about using namespaced XML: web service architecture, RDF, semantic web, XHTML, etc. All that stuff seems to have faded away into obscurity.
XML namespaces sound like a good idea until you realize that it just means endless verbosity that doesn't really serve much purpose and that really complicates things like parsing. Thankfully, people simply refused to apply that to json. Most json continues to be free of that nonsense. Same with yaml and similar formats. Works great without a lot of namespace urls.
Oh is that why. I had heard that comments were taken out because people were using it for "parser directives" or something vague. This makes a lot more sense (although I'm sure there were all manners of hacks in the comments). Definitely a bullet dodged there.
Elasticsearch is a positive exception. It will happily accept comments.
So some simple XML like
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<detail>
<ns2:SendMessageFault1_SendMessageFault xmlns:ns2="http://bip.bee.kz/SyncChannel/v10/Types">
<errorCode>SCE013</errorCode>
</ns2:SendMessageFault1_SendMessageFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
is represented by the following JSON monstrosity: {
"name": "soap:Envelope",
"attributes": [
{
"name": "xmlns:soap",
"value": "http://schemas.xmlsoap.org/soap/envelope/"
}
],
"children": [
"\n ",
{
"name": "soap:Body",
"children": [
"\n ",
{
"name": "soap:Fault",
"children": [
"\n ",
{
"name": "faultcode",
"children": [
"soap:Server"
]
},
"\n ",
{
"name": "detail",
"children": [
"\n ",
{
"name": "ns2:SendMessageFault1_SendMessageFault",
"attributes": [
{
"name": "xmlns:ns2",
"value": "http://bip.bee.kz/SyncChannel/v10/Types"
}
],
"children": [
"\n ",
{
"name": "errorCode",
"children": [
"SCE013"
]
},
"\n "
]
},
"\n "
]
},
"\n "
]
},
"\n "
]
},
"\n"
]
} { "errorCode "SCE013" }
That SOAP envelope is 99% just telling you it's a SOAP envelope, which technically is completely redundant because presumably you'd be aware of the fact that you are talking to a SOAP API. And apparently they had no schema for actually telling you anything meaningful about the error. Which is why it is represented as a string with an error code. That string is the only useful bit of information in the message.Basically the SOAP equivalent of Internal Server Error.
From a parsing point of view it's horrible because all those namespaces need to be resolved and the schemas need to be processed. And of course a lot of those namespace urls don't actually have servers behind them that serve those schemas. Most of those urls never resolved to anything useful at all. The servers that were supposed to host those schemas never existed.
Alternatively you just ignore all that crap and pick the message apart with XPath or a regular expression. That's what I used to do when dealing with SOAP APIs. Most of those APIs were just stupendously convoluted RPC wrappers anyway from some bit of enterprise crap ware. I never could be bothered to treat those systems with the respect they demanded from me. Way faster to just sidestep all that nonsense. Send a message, pick apart what comes back to determine success / failure and move on with your life.
That's why SOAP died. Because as soon as people caught up to this being the optimal way to deal with SOAP, the next logical thing was to get rid of it entirely.
The XML heyday is a little before my time, but I think attributes were considered improper design compared to only using tags by purists.
For example in the case the author supplied imagine if you wanted to add a compression type to a member. Your only choice would be an attribute which means that it can only be a string.
<struct>
<member name="faultCode"><int>-123</int></member>
<member name="faultString"><string>some fault</string></member>
</struct>
If in the original you could add a new element inside the member like <compression>
<algorithm>zstd</algorithm>
<dictionary>dict7</dictionary>
</compression>
Not the best example but the point stands. Of course the complaint is valid because while extensibility is valuable you need to weigh it against the cost of the verbosity (both in use and for developers). A <fault> struct may not contain members other than those specified.
This is true for all other structures. We believe the specification
is flexible enough so that all reasonable data-transfer needs can be
accomodated within the specified structures. If you believe strongly
that this is not true, please post a message on the discussion group.
At one point the author did intend to allow elements to contain user-defined children[0], but it seems like their position changed between that mailing list post and the spec update 7 days later.[0] https://web.archive.org/web/19991010205056/http://discuss.us...
I also think that this design was also reasonably well aligned with the internal XML capabilities of Frontier.
The opposite really, half-assed "good enough for me" is also very much visible in RSS.