Results 1 to 3 of 3

Thread: "The component was not expected" error

  1. #1
    Join Date
    Nov 2008
    Posts
    1,514

    "The component was not expected" error

    I am having a project designed in ASP.NET which is having a webreference to a web service. I recently added an object as a parameter to the webmethod in the webservice which calls business layer to do some calculations. But this gives me error saying "The component was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically." Can you explain me what is the cause of this error message?

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: "The component was not expected" error

    You generate serialization code to get XML serialization work. You first create serialization/de-serialization code in ASP.NET, compile it and then compile it. All of this should be done in just first call to the web service. Once the first call complete, do not recreate this code again. XmlInclude tells us know which serialization code we should use.

  3. #3
    Join Date
    May 2008
    Posts
    4,345

    Re: "The component was not expected" error

    The XmlInclude class can only serialize types that it is aware of.

    This can be achieved in two ways:

    1) Expose the property as an XmlElement and handle the serialization from your object into XML
    2) Create an extension and manage the serialization in the extension.

Similar Threads

  1. Replies: 2
    Last Post: 11-05-2012, 02:16 AM
  2. Replies: 4
    Last Post: 29-11-2010, 10:59 AM
  3. ADSI and VB 2008 Error "Cannot Create ActiveX Component"
    By Mysteria in forum Software Development
    Replies: 3
    Last Post: 22-05-2009, 11:30 AM
  4. "Identifier Expected" error in Dr Java
    By adam.taylor in forum Software Development
    Replies: 5
    Last Post: 12-05-2009, 11:55 AM
  5. Replies: 2
    Last Post: 08-12-2005, 05:03 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,018,096.08980 seconds with 16 queries