XmlSchemaElement type

Posted by user305287 on Stack Overflow See other posts from Stack Overflow or by user305287
Published on 2010-03-30T16:21:51Z Indexed on 2010/03/30 16:23 UTC
Read the original article Hit count: 422

Filed under:
|
|
|
|

Hi,

I'm generating WSDL of my web service dynamically, but when I set the XmlSchemaType of my elements, the ServiceDescriptor writes the element as an element rather than message, as I need.

The code looks like this:

XmlSchemaElement schemaElement = new XmlSchemaElement(); XmlSchemaComplexType complexType = new XmlSchemaComplexType(); XmlSchemaSequence sequence = new XmlSchemaSequence();

foreach (XmlSchemaComplexElementParameter param in element.Parameters) {
XmlSchemaElement paramElement = new XmlSchemaElement(); paramElement.Name = param.ParameterName; paramElement.SchemaTypeName = new XmlQualifiedName(param.ParameterType, "http://www.w3.org/2001/XMLSchema");

paramElement.MaxOccurs = param.MaxOccurs; paramElement.MinOccurs = param.MinOccurs;

sequence.Items.Add(paramElement); }

complexType.Particle = sequence;

schemaElement.Name = element.MessageName;
schemaElement.SchemaType = complexType;

Any ideas about this?

© Stack Overflow or respective owner

Related posts about wsdl

Related posts about c#