Sunday, December 13, 2009

E-mail reporting from Maintenance tasks in SQL Server 2008

Submit this story to DotNetKicks

Just migrated two databases to a new 2008 server, when I discovered something weird: You cannot choose in any way to alert operators on error in the maintenance plan. Under reports settings, there is a checkbox, but it's disabled, and I found that other users are not able to check it either. Plus it only allows you to send a report every time. Which is not what I want...

The only workaround I found applies to scheduled tasks, which I guess is reasonable - if you run the job manually, you shouldn't need an e-mail to see if it failed. SQL Server creates a job for you, that runs the task, and for jobs, you can set the Notification properties to send an e-mail.

Wednesday, December 9, 2009

Sending XML input to a web method expecting a string

Submit this story to DotNetKicks

I'm working on a project where I receive data in XML format. So far I have been using the auto-generated .asmx front-end form to send inn small XML one-liners just for testing my parsing logic.

But when I wanted to use soap UI to send in larger portions, not to mention being able to save the whole scenario for later use, I ran into a problem. Whatever I sent in I only got "#status# HTTP/1.1 400 Bad Request".

Even just sending just the XML declaration gave me this problem!

But when I sent the exact same string from the auto-generated form, it was working perfectly. Which led me to believe there was (as usual) someone working behind the scenes, doing things without asking me.

Finally I found a post with the answer I was looking for.

In short, wrap your XML inside a CDATA section, and you're good to go.