웹 서비스 컨텍스트에서 Mammal 클래스를 상속 한 다음 클래스가 있습니다. Mammal 클래스는 프록시에서 정의됩니다. 나는 그 클래스의 정의를 바꿀 수 없다. 클라이언트 측에서 Mammal 클래스에 몇 가지 메소드를 추가해야하기 때문에 Mammal을 상속하고 Giraffe를 만들었습니다. 내가 형 포유류의 객체를 기대의 WebMethod를 호출 할 때WebService, WebMethod 및 상속
namespace TestApplication
{
public class Giraffe : Mammal
{
public Giraffe()
{
}
}
}
, 나는 기린이 예상되지 않는다는 것을 말해 다음과 같은 예외를 얻을.
Error: System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type Giraffe was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterPaymentRequestAuthorization.Write6_Tender(String n, String ns, Tender o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterPaymentRequestAuthorization.Write12_PaymentRequestAuthorization(String n, String ns, PaymentRequestAuthorization o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterPaymentRequestAuthorization.Write13_PaymentRequestAuthorization(Object o)
--- End of inner exception stack trace ---
해결 방법이 있습니까? 나는 정말로 XmlInclude를 추가 할 수 없다 ...
이 스레드 http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types에서 보라 –