What does the web server logs say for the 502 error? What URL is being referenced?
I have tried this myself and it worked first time. What I can’t see from your example is what you are doing with the Tamino OCX. In my example, I call the Initialize() method, then use the PutcsDatabaseURL() method to set the URL of Tamino including collection name (e.g. http://localhost/tamino/mydb/mycol) and then invoke the PutDocument() method in the same way you have, i.e. 1st parameter null, and 2nd parameter a valid IDispatch pointer of the XML document.