I made a webservice with a webmethod receiving a udt object something
similar like this:
[webmethod]
public receivePerson(person curPerson){
// do something nice with curPerson
}
class Person {
public string name;
public string city;
}
So, obviously you call the webservice with this SOAP XML message (in a
SOAP envelope, but removed in this example):
<person>
<name>elmer</name>
<city>NY</city>
</person>
Not a big deal eh? In the webservice, I want to throw a SoapException
when something goes horribly wrong. And for a particular reason, I
want the person object in the details section of the SoapException. So
I declare my SoapException this way:
SoapException se = new SoapException("Fault occurred",
SoapException.ClientFaultCode,
Context.Request.Url.AbsoluteUri, node);
Throw se;
The node is the problem. How do I convert the object 'person' into a
XML node? I tried several options, like XmlSerialize, but I don't get
things to work. A lot of the examples I find on the internet are
creating local .xml files and I don't want to do that. Anyone ideas?