views:

10

answers:

0

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?