« Back to home

A REST Web Service antipattern: The 200 black hole

If you haven’t yet gotten around to implementing an API call on your Web Service, do not make it return HTTP 200 OK. Instead, return 501 Not Implemented. If you return 200 OK but your code does nothing, the caller is likely to assume that he made some kind of error performing the call, and could easily spend an entire afternoon trying different payload and parameter encodings and tracing code internals.…

Read more »

Getting UTF-8 out of Domino web agents

A common technique for getting XML data out of IBM Lotus Domino is to build an agent which outputs the DXL encoding of a document and call it via HTTP. The code typically looks like this:

Print "Content-type: text/xml"
Dim session As New NotesSession
Dim doc As NotesDocument
[...obtain your data somehow in the variable doc...]
Dim exporter As NotesDXLExporter
Set exporter = session.CreateDXLExporter
exporter.OutputDOCTYPE = False
Dim stream As NotesStream
Set stream = session.CreateStream
Call exporter.SetInput(doc)
Call exporter.SetOutput(stream)
Call exporter.Process
Print stream.ReadText()

However, there’s a subtle error in the above code. The kind of error that can make everything look fine in testing, then cause your integration work to fall over in production.

Read more »