Web services woes

by Marius Gheorghe 6. March 2007 21:23
Yikes. I discovered (the hard, lots of swearing way) 2 awkward things related to web services usage:

- the first occurs when you must include a certain type that can be return from WebService (most common example is DBNull). Although the documentation say to use SoapInclude it doesn't work. Use XmlInclude instead.

- the second one is related to the use of custom SoapHeader. I was using a custom SopaHeader for authentification (no WSE for me thank you very much). The problem was that the public instance of the SoapHeader always had the properties null. Checked the types, check the names, look on sample on the net. I couldn't discover any problem with my code. Double check everything. Triple checked everything. Until i small detail caught my eye : as a good old 'listen to Microsoft coding guidelines' kind of guy i was using properties instead of public fields. All the samples were using public fields.....changed to fields and...it worked. There are , of course, 2 problems : this proves, once again if ti was necessary, that it's REALLY stupid that the reflection API makes a difference, API wise, between and fields and properties. And that the guy who wrote that code was lazy.

I'm posting this hoping that might help somebody who will find itself in my situation.

Tags:

dotNET

Comments are closed

marius gheorghe

developer, dad, gamer

Contact me

My Resume

Favourite Tools