Cathy,
It's almost impossible to do this with a WebMethod. Ideally, the way
that this would translate into WSDL would be that the parameter and the
return value would allow any valid XML. This would also mean that you have
to process the XML yourself to interpret the contents correctly.
Basically, this kind of design is not recommended. You are better off
creating more strongly typed versions, or rather, expose XML as the inputs
and/or outputs and do some pre-post processing.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
<ca**********@yahoo.co.uk> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
I have a web service which exposes a method...
[WebMethod]
public Object Invoke(Object obj)
{
...
}
both the input param and the return value objects can, in reality, be
anything. Howver, if I call this method from a client and cast my own
custom object as Object, I get this error...
System.InvalidOperationException: The type MyType was not expected. Use
the XmlInclude or SoapInclude attribute to specify types that are not
known statically.
My custom class is defined like this...
[XmlInclude( typeof( MyType ) )]
public class MyType
{
...
}
Obviously I need to do more, but what?
Cathy