469,270 Members | 1,011 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

.NET WebService method doesn't understand xsd list

I've posted this before but no one seems to respond. I need to know if this is a bug

I am implementing a webservice against a preexisting schema/wsdl

The schema specifies an element called Type that is a xml schema list of qname (i.e. it wants the message to have a space deimited list of qnames.)

However wsdl.exe interprets this incorrectly as 'XmlQualifiedName Types' rather than 'XmlQualifiedName [] Types'. Simply changing the type in the C# class to an array results in incorrect serialization/exceptions. This is a fairly common piece of schema so I'm surprised at the lack of support for it

Is there anything I can do to force the array to serialize/deserialize as a correct xml schema list? Perhaps a set of Xml Attributes or something? So far I've had no luck

Nov 12 '05 #1
4 2179
can we see the wsdl and or xsd ?
-Dino

"ma***@online.nospam" <an*******@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
I've posted this before but no one seems to respond. I need to know if this is a bug.
I am implementing a webservice against a preexisting schema/wsdl.

The schema specifies an element called Type that is a xml schema list of qname (i.e. it wants the message to have a space deimited list of qnames.)
However wsdl.exe interprets this incorrectly as 'XmlQualifiedName Types' rather than 'XmlQualifiedName [] Types'. Simply changing the type in the C#
class to an array results in incorrect serialization/exceptions. This is a
fairly common piece of schema so I'm surprised at the lack of support for
it.
Is there anything I can do to force the array to serialize/deserialize as a correct xml schema list? Perhaps a set of Xml Attributes or something?
So far I've had no luck.

Nov 12 '05 #2
after seeing your prior post

can you serialize to a string and then do your own parsing of the qnames?

"ma***@online.nospam" <an*******@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
I've posted this before but no one seems to respond. I need to know if this is a bug.
I am implementing a webservice against a preexisting schema/wsdl.

The schema specifies an element called Type that is a xml schema list of qname (i.e. it wants the message to have a space deimited list of qnames.)
However wsdl.exe interprets this incorrectly as 'XmlQualifiedName Types' rather than 'XmlQualifiedName [] Types'. Simply changing the type in the C#
class to an array results in incorrect serialization/exceptions. This is a
fairly common piece of schema so I'm surprised at the lack of support for
it.
Is there anything I can do to force the array to serialize/deserialize as a correct xml schema list? Perhaps a set of Xml Attributes or something?
So far I've had no luck.

Nov 12 '05 #3
Here is the xsd for the list of qnames. The result should be an object called Probe with a member Types that is an array of XmlQualifiedName. Instead it is simply a single XmlQualifiedName. Also the serializer does not seem to know how to serialize a list in the space delimited manner that is required. Incidentally if you make the xsd list an attribute instead of the element contents it does serialize as a list. This is interesting but doesn't help me

<xs:element name='Probe' ><xs:complexType><xs:sequence><xs:element ref='tns:Types' minOccurs='0' /></xs:sequence></xs:complexType></xs:element><!-- Shared global elements --><xs:element name='Types' type='tns:qnlist' /><xs:simpleType name="qnlist"><xs:list itemType='xs:QName' /></xs:simpleType>
Nov 12 '05 #4
I don't know if xsd:list is supported, I haven't used it.

one way to approach this may be to XmlIgnore the actual array of types.
this will prevent the "incorrect serialization" you described previously.
Then add a "shadow member" that helps you serialize the way you want. Make
this member a string. It should have the name specified in your XSD - eg,
Types. You will need a getter and a setter, but the setter should be a
no-op. The getter should examine the array of XmlQualifiedNames and then
build a space-delimited-string that represents the list.

Does this work?

eg

[XmlIgnore]
XmlQualifiedName[] m_Types;

public String Types{
set {
}
get {
String s;
foreach(XmlQualifiedName xqn in m_Types) {.... } // build string
here
return s;
}
}
"ma***@nospam.com" <an*******@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
Here is the xsd for the list of qnames. The result should be an object called Probe with a member Types that is an array of XmlQualifiedName.
Instead it is simply a single XmlQualifiedName. Also the serializer does
not seem to know how to serialize a list in the space delimited manner that
is required. Incidentally if you make the xsd list an attribute instead of
the element contents it does serialize as a list. This is interesting but
doesn't help me.
<xs:element name='Probe' ><xs:complexType><xs:sequence><xs:element

ref='tns:Types' minOccurs='0'
/></xs:sequence></xs:complexType></xs:element><!-- Shared global
elements --><xs:element name='Types' type='tns:qnlist' /><xs:simpleType
name="qnlist"><xs:list itemType='xs:QName' /></xs:simpleType>
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Arne | last post: by
7 posts views Thread by stephan querengaesser | last post: by
9 posts views Thread by Greger | last post: by
reply views Thread by Paul Hadfield | last post: by
6 posts views Thread by Peter | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.