The type '' was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically

Posted on 2014-11-17
Last Modified: 2016-02-16

When my Soap Web Service is called, it does everything what it should but generates the following soap error message:

<soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
            <soap:Text xml:lang="en">System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type BBTSerenaIntegration.ZMFWebservice_PackageLifeCycleServices.response was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write4_Type(String n, String ns, Type o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_Header(String n, String ns, Header o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write7_Output(String n, String ns, Output o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write27_ZMF_FreezePackageResponse(Object[] p)
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer25.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
   at System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
   at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
   at System.Web.Services.Protocols.WebServiceHandler.Invoke()
   --- End of inner exception stack trace ---</soap:Text>

I have tried to add the includes as suggested in the error message but both entries didn't solve the issue:

In the attachments you can find the Soap Web Service (BBTSerenaIntegration.asmx.cs) and the Operations class (ZMFOperation.cs) which is being called by the Soap Web Service.
ZMFWebservice_PackageLifeCycleServices is a reference to a Soap Web Service.

Thanks in advance for all the assistance.


Question by:tcorigli
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

ItWorked earned 500 total points
ID: 40449501
I guess you have done wrong!

    public Output freezePackage(String package)

Open in new window

Attribute [SoapInclude] is not required for internal class operation.Check here.

What I suggest instead,
Place a break point at return statement at below line of code.
    ZMFOperations zmfOperations = new ZMFOperations();
    Output output = zmfOperations.freezePackage(package);
    return output;

Open in new window

Check what's

Open in new window

of "output" object (you can use object.GetType() to identify that) and add below line of code in BBTSerenaIntegration.asmx.cs
    public Output ZMF_FreezePackage(String package)

Open in new window

This shall work. Let me know if issue still persist.

Featured Post

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as high-speed processing of the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
parse string in c# 5 41
Need to Interpret Json in ( .net 3.5  framework) 11 51 repeater 2 38
SQL State HYT00. Timeout expired proplem 8 44
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
New Relic recently released its Synthetics product that allows for the creation of performance monitors that periodically test a site's performance. If you wish to test an interactive workflow New Relic employs Selenium WebDriverJS to run those test…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question