Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / April 2004

Tip: Looking for answers? Try searching our database.

System.InvalidOperationException: The type myobject[] may not be used in this context.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeremy - 30 Apr 2004 01:57 GMT
I am trying to return a custom object from a web service, and get this very
cryptic message.

       System.InvalidOperationException: There was an error generating the
XML document. --->
            System.InvalidOperationException: The type myobject[] may not
be used in this context.

What does it mean?

The object I am returning has a couple of fields, plus an array containing
objects.  The error message indicates a problem with creating xml for an
object in the array of objects.

Either no one else has problems with this, or no one else is doing this.
Maybe there is a better way.  I'm open to suggestions.

Jeremy
Trebek - 30 Apr 2004 14:38 GMT
Take a look at the XmlIncludeAttribute class (or SoapInclude if SoapRpc --
depending on your needs).

Should fix you up ....

Alex

> I am trying to return a custom object from a web service, and get this very
> cryptic message.
[quoted text clipped - 14 lines]
>
> Jeremy
Jeremy - 30 Apr 2004 17:29 GMT
Alex, thanks.  Can you help me out with the syntax?  Based on the c# example
in help, I deduce the following VB, but it gives a syntax error telling me I
need more continuation characters.  The squigglies show up under the "<" in
"<xmlinclude(...".
<WebMethod()> _

<xmlinclude(typeof(myMainObject)), xmlinclude(typeof(myEmbeddedObject))> _

Public Function getData(ByVal key1 As String, ByVal key2 As String) As
myMainObject

   getData = some stuff.

end function

Jeremy

> Take a look at the XmlIncludeAttribute class (or SoapInclude if SoapRpc --
> depending on your needs).
[quoted text clipped - 23 lines]
> >
> > Jeremy
Trebek - 30 Apr 2004 17:52 GMT
Sorry Jeremy .. never messed with vb or vb.net ... always been a C-based
programmer :( but I though it *should* look something like the following
based on MSDN:

<XmlElement(Type:=GetType(your_first_possible_class)),
XmlElement(Type:=GetType(your_next_possible_class))>

HTH,

Alex

> Alex, thanks.  Can you help me out with the syntax?  Based on the c# example
> in help, I deduce the following VB, but it gives a syntax error telling me I
[quoted text clipped - 42 lines]
> > >
> > > Jeremy
Trebek - 30 Apr 2004 17:55 GMT
Opps ... replace with the appropriate attribute :)

Alex

> Sorry Jeremy .. never messed with vb or vb.net ... always been a C-based
> programmer :( but I though it *should* look something like the following
[quoted text clipped - 60 lines]
> > > >
> > > > Jeremy
Jeremy - 30 Apr 2004 18:32 GMT
Easy for you to say (g).  I've tried xmlinclude and xmlincludeattribute, to
no avail.  Seems to be some confusion about whether I should use gettype()
or typeof(), but have tried both.  I added the "type:=" construct, but that
didn't matter one way or the other.  What a quaint and convoluted language
MS has produced. - Jeremy

> Opps ... replace with the appropriate attribute :)
>
> Alex

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.