Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 138081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:12:28+00:00 2026-05-11T07:12:28+00:00

In a Web Service context, I have the following class which inherit from the

  • 0

In a Web Service context, I have the following class which inherit from the class Mammal. The Mammal class is defined in a proxy. I cannot change the definition of that class. Because I need to add some methods to the class Mammal on the client side, I inherited Mammal and created Giraffe.

namespace TestApplication {       public class Giraffe : Mammal     {         public Giraffe()         {         }     } } 

When I call a WebMethod which expect an object of type Mammal, I get the following exception telling me that Giraffe isn’t expected.

  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 --- 

Is there a workaround that? I cannot really add the XmlInclude…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:12:28+00:00Added an answer on May 11, 2026 at 7:12 am

    To add methods, you should be using partial classes. Try adding a second class file with (in the right namespace etc):

    partial class Mammal {     public void ExtraMethod() {...} } 

    The partial keyword tells the compiler to allow the class to be split over multiple files – ideal for code-generation scenarios. It does, however, demand the partial keyword in every file; the members are simply combined (except for partial methods in C# 3.0 which have their own subtle behaviour). I hope that wsdl.exe (or whatever) includes this!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in a class that is called from a web
I have the following Ria Service define: namespace SilverlightTest.Web { [EnableClientAccess()] public class ContactService
I have a jboss web service that is getting the wrong initial context. I
I made a Web service in which I have a function to count some
I have web service which i want to use to upload image to the
I have a known working web service which is configured as a SOAP and
I have an application architecture which has following layers (or c# projects). web front
In web.xml I have the following: <servlet> <description>JAX-WS endpoint - EARM</description> <display-name>jaxws-servlet</display-name> <servlet-name>jaxws-servlet</servlet-name> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
I have the following class that doesn't seem to be returning a List from
Say I have a web service where I want to serve the content only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.