Problems about the Spectrum Data Model - the SOAP issue
dobos at pha.jhu.edu
Fri Sep 15 03:39:45 PDT 2006
I didn't look at the SOAP standard actually, but experienced this problem
when I tried creating the Spectrum Service. If I creat a WS that exports a
class that has mixed type serialization set, and I generat a proxy class
using the .net or mono tools it does not want to use any other data type for
the field but string, even though most of the fields that are intended to be
serialized as text between tags are numerical data.
The .net documentation says the following:
The XML Schema Definition Tool (Xsd.exe) occasionally generates the
XmlTextAttribute when creating classes from an XML Schema definition (XSD)
file. This occurs when the schema contains a complexType with mixed content;
in that case, the corresponding class contains a member that returns a
string array to which the XmlTextAttribute is applied.
(.net uses attributes to control how objects and class fields are serialed,
XmlTextAttribute directs the serializer to serialize an element as text
between tags, and, for example, XmlElementAttribute forces the serializer to
serialize a field as an element.)
A more detailed document from MS:
However, I'm a practical guy and still suggesting omitting mixed content
from the VO standard if it does not work with any of the main WS
implementations. Why actually do we need that number right between the tags
instead of in an attribute?
Also, using mixed content is an _extension_ to the basic XSD, and we can
design standards that are going to last for decades, as FITS do, and
introduce extensions that arise incompatibility, but if we want to create
web services right now, we should keep in mind the SOAP restrictions.
Anyway XSD is for validating XML documents. SOAP is for serializing in
memory object into XML. Of course XML has more possibilities for twisting
data types than a programming language, and that's why SOAP has more
constaints on the schema. And these constraints are existing not just
because the MS guys didn't want to implement the whole standard.
> yes, I agree: let's try not to mix text and element children of
> elements, even though SOAP 1.2 allows it. However, I don't see why we
> shouldn't have attribute and element children of the same element.
Attributes and Elements can be mixed, but none of these with inline text.
More information about the dm