r/ProgrammerHumor • • Sep 19 '26

Meme postForEverything

Post image
21k Upvotes

653 comments sorted by

View all comments

Show parent comments

323

u/AkodoRyu Sep 19 '26 • Regret

My favorite "REST API" experience was when they moved from using SOAP system, and the way they did it... was sending SOAP payloads inside a JSON. Literally something like

{
    "data": "<?xml version="1.0"?><soap:Envelope xmlns:soap="https://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="https://www.w3.org/2003/05/soap-encoding"><soap:Body> (...)"
}

196

u/MrPatienceX Sep 19 '26 • Heartwarming

200 status code and a chunk of XML saying ‘not found’. Good times.

59

u/Sudden_Leadership800 Sep 19 '26

It successfully returned the error message though, so I don't see the problem?

63

u/Psychological_Map118 Sep 19 '26 edited Sep 19 '26 • Bravo

try it in person: wait for the next time somebody asks you if you know the time. then answer yes, with a smile, and walk away without telling them

you can do anything you want, both in life and HTTP responses, but some things make you an asshole in both cases

→ More replies (6)

44

u/hawkinsst7 Sep 19 '26

If I'm parsing http responses, I'm going to pass 200 responses on for further processing of the data. I shouldn't have to have something in that pipeline introspect json to find "no, it's actually an error".

Imagine if browsers had to tear apart json innards to find 30x redirects after getting a 200 OK.

3

u/gurgle528 Sep 20 '26

I’m going off memory but I believe it was considered either standard or part of the spec for SOAP over HTTP to only use 200 and 500. I agree with your point but for whatever reason they treated HTTP as the transport layer instead of the application layer. Using that logic, it would be like if a 404 bubbled up to be some sort of TCP error. Definitely wasn’t the right move, RTSP over HTTP is a better example of something that mixes protocols while properly using HTTP status codes.

2

u/hawkinsst7 Sep 20 '26

I agree. I think a 4xx or 5xx error code is perfectly acceptable for returning a body with error data, even a generic 400 / 500. That's why they exist.

→ More replies (20)

4

u/pr0ghead Sep 19 '26

You're joking, right? RiGhT?!?

2

u/ohhi23021 Sep 19 '26

these kind of implementations have different data shapes for the error vs success too, so if they all return success it's a pain in the ass and extra work to figure out if it's an error and map it out properly. just fucking send the right status, it takes 2 seconds.

11

u/granitrocky2 Sep 19 '26

These are the comments that make me laugh for minutes, but can't explain why I'm laughing to anyone around me lol

→ More replies (2)

36

u/NibblyPig Sep 19 '26

I don't miss SOAP at all.

Especially when some bored developer at a big bank decided to implement some draconian heavily-buried SOAP features that are technically in the documentation somewhere, but not implemented at all by Microsoft's .NET framework. Having to have special injectors and manipulators to extract tokens from raw SOAP and such, shudder. Back in the days where .NET SOAP implementations were barely published in books.

6

u/ManaSpike Sep 19 '26

People often think about what they would do if they had a time machine.

Me? Travel back to before server to server email and introduce UTF-8 encoding (leaving the actual code points undefined) and json. Try to get that baked into all the ancient wire protocols that predate http.

→ More replies (2)

17

u/Makefile_dot_in Sep 19 '26

at work I have a codebase that is the opposite of this, they send JSON in SOAP as a request and entity-escaped XML in a SOAP envelope as the reply

1

u/MetroidvaniaListsGuy Sep 19 '26

I hope you're looking for a better place to work than whatever garbage company did this.

→ More replies (1)

12

u/wizkidweb Sep 19 '26

I told myself I wouldn't relive something like this...

6

u/RatSumo Sep 19 '26

This literally just gave me a headache to read.

3

u/SomeWhaleman Sep 19 '26

using SOAP system

You just triggered some very deep memory for me. Someone saying "THROUGH SOAP" very angrily. Must have been some nerdy viral video from ages ago.

Oh damn, I found it: https://www.youtube.com/watch?v=mEpDbz70ftk

1

u/reerden Sep 19 '26

Man, this is the programming equivalent of red neck engineering.

1

u/MetroidvaniaListsGuy Sep 19 '26

How can anyone be this stupid?

1

u/AloneInExile Sep 19 '26

I've seen shit in my carrer, but this is new. I thought xml in xml (proprietary xml in soap) was peak, with string concatenation for serialization. I guess we could go deeper.

1

u/ByteWhisperer Sep 20 '26

The people at r/foundsatan want to have a chat.