المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Web Service Returns Null, No Exceptions



C# Programming
05-05-2011, 08:00 PM
I'm having a problem with a web service in my C# code. I've consumed the web service by adding a web reference and all is good, the reference is consumed correctly I'm getting all my proxy types flow through etc. etc.

When I run a method on the service, however, the returned object is null and no exceptions are thrown:
// after this line, response is null MethodResponse response = service.Method(methodRequest); I'm running Fiddler in the background (HTTPS decryption is turned off, even though I'm simply running on HTTP) and I'm getting a legitimate XML response back - it maps perfectly to my response types. I've added some code where I can manually copy the XML response from Fiddler into the code, use an XmlDeserializer, and it works just fine.

I have noticed one thing, though. The request I send has an XML declaration at the beginning of it, whereas the response does not. If I set up Fiddler's auto-responder with the legit response and add an XML declaration to it, I get an exception:
There is an error in XML document (120, 15). Unexpected end of file while parsing Name has occurred. Line 120, position 15. That line and position are a bit of a red-herring, as they don't point to anything useful in particular (not even the EOF), and as I said before, the XML is valid. Also, there is no Name element in the XML at all, so I'm assuming it means that it's trying to parse a tag name (which one it doesn't say), not finding the end of it for whatever reason and then passing the EOF.

Any ideas as to what's going on or where I should look next?

Typical n-tiered architecture:
DB Junk(0) ... Junk(n-1) Pretty