Re: How to send up a multi-dimensional array in a property of type system.object?



On Jul 19, 8:46 pm, "John Saunders [MVP]" <john.saunders at
trizetto.com> wrote:
<p...@xxxxxxxxxx> wrote in message

news:1184858454.441522.70840@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

It's really amazing that this works at all.

Consider that you're serializing your objects into XML for some other piece
of code to deserialize. You aren't giving that client code much information
about what you're sending. Have you looked at the generated WSDL? The Val
field is declared:

<s:element minOccurs="0" maxOccurs="1" name="Val" />

This only works at all because the type information will be included in the
XML for the primitive types:

<Val xsi:type="xsd:dateTime">2007-07-19T15:39:52.4875-04:00</Val>

Which xsi:type should it use for Field[][]?

BTW, it _does_ work if you wrap the Field[][]. Furthermore, if you don't
want the two to be different, then you should always use the wrapped
version. Have your webmethod return WrappedArrayOfArrayOfField. That will
return something like this:

<Val xsi:type="FieldWrapper">
<Wrapped>
<ArrayOfField>
<Field>
<Name>name1</Name>
<Val xsi:type="xsd:int">1</Val>
</Field>
<Field>
<Name>name2</Name>
<Val xsi:type="xsd:string">abc</Val>
</Field>
</ArrayOfField>
...

That's the part that I don't get; I have looked at the WSDL (far too
many times!), and I can see the overall result node:

<s:element name="GetTasksResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetTasksResult"
type="tns:ArrayOfArrayOfField" />
</s:sequence>
</s:complexType>
</s:element>

So, in answer to your question:

Which xsi:type should it use for Field[][]?

I would have thought tns:ArrayOfArrayOfField would be the type it
would serialize as. There is a node with that name in the WSDL
already, so I don't understand why it can't utilise that?

I've tried putting a string[][] into Val, and that blows up too, so it
seems that it's just a problem putting a multi-dimensional (well,
jagged) array into the Val.

In fact, we just tried returning a jagged array from a web method that
returns one System.object, tried returning string[][], and that
doesn't work either, so that seems to confirm that you just can't
return a jagged array as System.object. I'm intrigued as to why that
is the case though.

Cheers,

Paul

.



Relevant Pages

  • RE: serializing string property (which contains XML) to SOAP message..
    ... If you can avoid using XML in our classes, ... serializing string property to SOAP message.. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • XmlSerialize Image
    ... I need to XmlSerialize Images. ... I found a workarround which works good by serializing a byte(instead ... But the Xml is not beautifull and look like that: ... When i look to a resx file, images serialized in xml are formatted with ...
    (microsoft.public.dotnet.framework)
  • Re: Skipping parts of a serialized file
    ... These days, my preference is XML. ... Those who have access can check out the article on the techniques we developed in the 1979 ... of runtime information from serializing a CDocument. ... I disagree with Joseph on the general usefulness of MFC ...
    (microsoft.public.vc.mfc)
  • Re: Amazons "Simple" Database
    ... The only real value I can find in XML there is that currently we don't really have a commonly accepted and implemented format in which to serialize datasets. ... Sometimes we even get to the point of serializing to a proper, shared, concrete format, so that the compatibility runs deeper. ... People worry too much about the metaformat to lay the proper groundwork for the actual formats. ...
    (comp.databases.theory)
  • Re: Still Problems Serializing Arrays
    ... MVP XML ... > Conversation: Still Problems Serializing Arrays ... > Public Sub New ... > Public Sub New(ByVal id As String, ByVal fn As String, ByVal ln As ...
    (microsoft.public.dotnet.xml)

Loading