Ask a Question related to ASP.NET Web Services, Design and Development.
-
john harkin #1
Cannot serialize object of type System.Object[,]. Multidimensional arrays are not supported
Hi,
I get this on server when trying to retun a 2 dim array.
I apprecaite that they are not supported as per
[url]http://support.microsoft.com/default.aspx?scid=kb;en-us;316273[/url]
however i'm looking for as a work around as my web service is a layer
in front of an existing com object which cannot be changed and it
returns the 2 dim array.
All thoughts welcome.
JOhn
john harkin Guest
-
Object of type 'System.String' cannot be converted to type 'System
I'm trying to get a control from metabuilders.com dual list)to work under ASP.NET 2.0. It worked find under 1.1 and then when i migrated my... -
[WebMethod] System.NullReferenceException: Object reference not set to an instance of an object.
Um, this isn't going to work, generally. Web services, as any web app (especially on Windows server 2003) are heavily sandboxed. The method you... -
Split multidimensional array into 4 multidimensional arrays
Hello everyone, I have a multidimensional array that I need to split into 4 multidimensional arrays. I've tried the examples from the... -
Cannot serialize the object using XmlSerializer
I have a feeling I'm missing something simple here. I cannot get even the most simple WebControl to be serialized into an XML file. I keep getting... -
Cannot create an object of type 'System.String[]' from its representation 'String[] Array'
Hello, I am designing a .net custom control in VS.net 7.1 and my control exposes an array of strings which are supposed to be the items to show. To... -
Christoph Schittko [MVP] #2
Re: Cannot serialize object of type System.Object[,]. Multidimensional arrays are not supported
You can return jagged arrays, i.e.
System.Object[][] instead of System.Object[,].
HTH,
Christoph Schittko
MVP XML
[url]http://weblogs.asp.net/cschittko[/url]
> -----Original Message-----
> From: john harkin [mailto:jjhnospam@yahoo.co.uk]
> Posted At: Tuesday, September 21, 2004 2:58 AM
> Posted To: microsoft.public.dotnet.framework.aspnet.webservic es
> Conversation: Cannot serialize object of type System.Object[,].
> Multidimensional arrays are not supported
> Subject: Cannot serialize object of type System.Object[,].
> Multidimensional arrays are not supported
>
> Hi,
> I get this on server when trying to retun a 2 dim array.
> I apprecaite that they are not supported as per
> [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;316273[/url]
>
> however i'm looking for as a work around as my web service is a layer
> in front of an existing com object which cannot be changed and it
> returns the 2 dim array.
>
> All thoughts welcome.
>
> JOhnChristoph Schittko [MVP] Guest
-
john harkin #3
Re: Cannot serialize object of type System.Object[,]. Multidimensional arrays are not supported
Hi,
Thanks very much for this and it worked.
I'm actually need to retun an object which could contain object[][].
One thing i notice
[WebMethod]
public object ReturnJaggedArrayAsObject()
{
object[][] numbers = new object[2][] { new object[] {2,"string1",
24.56}, new object[] {4,"string2", 56.78} };
object a = (object) numbers;
return a;
}
didn't work and got a serialisation error but when i added
[WebMethod]
public object[][] Fred()
{
object[][] numbers = new object[2][] { new object[] {2,"string1",
24.56}, new object[] {4,"string2", 56.78} };
return numbers;
}
to the source file i was able to call ReturnJaggedArrayAsObject.
It appears that by having Fred it knows about object[][] in wsdl.
Any way of achieving this without defining Fred?
Regards
"Christoph Schittko [MVP]" <INVALIDEMAIL@austin.rr.com> wrote in message news:<#$za3n9nEHA.2616@tk2msftngp13.phx.gbl>...> You can return jagged arrays, i.e.
>
> System.Object[][] instead of System.Object[,].
>
> HTH,
> Christoph Schittko
> MVP XML
> [url]http://weblogs.asp.net/cschittko[/url]
>>> > -----Original Message-----
> > From: john harkin [mailto:jjhnospam@yahoo.co.uk]
> > Posted At: Tuesday, September 21, 2004 2:58 AM
> > Posted To: microsoft.public.dotnet.framework.aspnet.webservic es
> > Conversation: Cannot serialize object of type System.Object[,].
> > Multidimensional arrays are not supported
> > Subject: Cannot serialize object of type System.Object[,].
> > Multidimensional arrays are not supported
> >
> > Hi,
> > I get this on server when trying to retun a 2 dim array.
> > I apprecaite that they are not supported as per
> > [url]http://support.microsoft.com/default.aspx?scidkb;en-us;316273[/url]
> >
> > however i'm looking for as a work around as my web service is a layer
> > in front of an existing com object which cannot be changed and it
> > returns the 2 dim array.
> >
> > All thoughts welcome.
> >
> > JOhn
> --john harkin Guest
-
Christoph Schittko [MVP] #4
Re: Cannot serialize object of type System.Object[,]. Multidimensional arrays are not supported
Have you tried declaring the array via an Xml serialization attribute on
the return value:
[WebMethod]
[return: XmlElement(typeof(object[][]))]
public object ReturnJaggedArrayAsObject()
{
object[][] numbers = new object[2][]
{
new object[] {2,"string1", 24.56}, new object[]
{4,"string2", 56.78} };
You may have to attach more attributes to declare the types in the
array... not sure at all if this works.
HTH
Christoph Schittko
MVP XML
[url]http://weblogs.asp.net/cschittko[/url]
object[]> -----Original Message-----
> From: john harkin [mailto:jjhnospam@yahoo.co.uk]
> Posted At: Thursday, September 23, 2004 6:18 AM
> Posted To: microsoft.public.dotnet.framework.aspnet.webservic es
> Conversation: Cannot serialize object of type System.Object[,].
> Multidimensional arrays are not supported
> Subject: Re: Cannot serialize object of type System.Object[,].
> Multidimensional arrays are not supported
>
> Hi,
> Thanks very much for this and it worked.
> I'm actually need to retun an object which could contain object[][].
> One thing i notice
>
>
> [WebMethod]
> public object ReturnJaggedArrayAsObject()
> {
> object[][] numbers = new object[2][] { newobject[]> {2,"string1",
> 24.56}, new object[] {4,"string2", 56.78} };
> object a = (object) numbers;
> return a;
>
> }
>
> didn't work and got a serialisation error but when i added
>
> [WebMethod]
> public object[][] Fred()
> {
> object[][] numbers = new object[2][] { newmessage> {2,"string1",
> 24.56}, new object[] {4,"string2", 56.78} };
>
> return numbers;
>
> }
>
> to the source file i was able to call ReturnJaggedArrayAsObject.
> It appears that by having Fred it knows about object[][] in wsdl.
> Any way of achieving this without defining Fred?
>
> Regards
>
>
> "Christoph Schittko [MVP]" <INVALIDEMAIL@austin.rr.com> wrote inlayer> news:<#$za3n9nEHA.2616@tk2msftngp13.phx.gbl>...> > You can return jagged arrays, i.e.
> >
> > System.Object[][] instead of System.Object[,].
> >
> > HTH,
> > Christoph Schittko
> > MVP XML
> > [url]http://weblogs.asp.net/cschittko[/url]
> >> > > -----Original Message-----
> > > From: john harkin [mailto:jjhnospam@yahoo.co.uk]
> > > Posted At: Tuesday, September 21, 2004 2:58 AM
> > > Posted To: microsoft.public.dotnet.framework.aspnet.webservic es
> > > Conversation: Cannot serialize object of type System.Object[,].
> > > Multidimensional arrays are not supported
> > > Subject: Cannot serialize object of type System.Object[,].
> > > Multidimensional arrays are not supported
> > >
> > > Hi,
> > > I get this on server when trying to retun a 2 dim array.
> > > I apprecaite that they are not supported as per
> > > [url]http://support.microsoft.com/default.aspx?scidkb;en-us;316273[/url]
> > >
> > > however i'm looking for as a work around as my web service is a> >> > > in front of an existing com object which cannot be changed and it
> > > returns the 2 dim array.
> > >
> > > All thoughts welcome.
> > >
> > > JOhn
> > --Christoph Schittko [MVP] Guest



Reply With Quote

