This documentation is archived and is not being maintained.

ServiceDescription.Types Property

Gets or sets the Types contained by the ServiceDescription.

[Visual Basic]
Public Property Types As Types
[C#]
public Types Types {get; set;}
[C++]
public: __property Types* get_Types();
public: __property void set_Types(Types*);
[JScript]
public function get Types() : Types;
public function set Types(Types);

Property Value

A Types instance representing the datatypes of both the parameters and return values of the methods exposed by the XML Web service.

Remarks

The Types instance returned by this property corresponds to the list of <types> elements enclosed by the Web Services Description Language (WSDL) <definitions> root element. For more information about WSDL, see the specification at http://www.w3.org/TR/wsdl/.

Example

[Visual Basic] 
myServiceDescription.Types.Schemas.Remove( _
   myServiceDescription.Types.Schemas(0))
Dim myXmlSchema As New XmlSchema()
myXmlSchema.AttributeFormDefault = XmlSchemaForm.Qualified
myXmlSchema.ElementFormDefault = XmlSchemaForm.Qualified
myXmlSchema.TargetNamespace = myServiceDescription.TargetNamespace

Dim myXmlElement1 As New XmlSchemaElement()
myXmlElement1.Name = "Add"

Dim myXmlSchemaComplexType As New XmlSchemaComplexType()
Dim myXmlSchemaSequence As New XmlSchemaSequence()
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement( _
   "1", "1", "a", New XmlQualifiedName("s:float")))

myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement( _
   "1", "1", "b", New XmlQualifiedName("s:float")))

myXmlSchemaComplexType.Particle = myXmlSchemaSequence
myXmlElement1.SchemaType = myXmlSchemaComplexType
myXmlSchema.Items.Add(myXmlElement1)

Dim myXmlElement2 As New XmlSchemaElement()
myXmlElement2.Name = "AddResponse"
myXmlSchemaComplexType = New XmlSchemaComplexType()
myXmlSchemaSequence = New XmlSchemaSequence()
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement( _
   "1", "1", "AddResult", New XmlQualifiedName("s:float")))

myXmlSchemaComplexType.Particle = myXmlSchemaSequence
myXmlElement2.SchemaType = myXmlSchemaComplexType
myXmlSchema.Items.Add(myXmlElement2)

Dim myXmlElement3 As New XmlSchemaElement()
myXmlElement3.Name = "Subtract"
myXmlSchemaComplexType = New XmlSchemaComplexType()
myXmlSchemaSequence = New XmlSchemaSequence()
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement( _
   "1", "1", "a", New XmlQualifiedName("s:float")))

myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement( _
   "1", "1", "b", New XmlQualifiedName("s:float")))

myXmlSchemaComplexType.Particle = myXmlSchemaSequence
myXmlElement3.SchemaType = myXmlSchemaComplexType
myXmlSchema.Items.Add(myXmlElement3)

Dim myXmlElement4 As New XmlSchemaElement()
myXmlElement4.Name = "SubtractResponse"
myXmlSchemaComplexType = New XmlSchemaComplexType()
myXmlSchemaSequence = New XmlSchemaSequence()
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement( _
   "1", "1", "SubtractResult", New XmlQualifiedName("s:int")))

myXmlSchemaComplexType.Particle = myXmlSchemaSequence
myXmlElement4.SchemaType = myXmlSchemaComplexType
myXmlSchema.Items.Add(myXmlElement4)

' Add the schemas to the Types property of the ServiceDescription.
myServiceDescription.Types.Schemas.Add(myXmlSchema)

[C#] 
myServiceDescription.Types.Schemas.Remove(
   myServiceDescription.Types.Schemas[0]);
XmlSchema myXmlSchema = new XmlSchema();
myXmlSchema.AttributeFormDefault = XmlSchemaForm.Qualified;
myXmlSchema.ElementFormDefault = XmlSchemaForm.Qualified;
myXmlSchema.TargetNamespace = myServiceDescription.TargetNamespace;

XmlSchemaElement myXmlElement1 = new XmlSchemaElement();
myXmlElement1.Name="Add";

XmlSchemaComplexType myXmlSchemaComplexType = 
   new XmlSchemaComplexType();
XmlSchemaSequence myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement(
   "1", "1", "a", new XmlQualifiedName("s:float")));

myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement(
   "1", "1", "b", new XmlQualifiedName("s:float")));
                                     
myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
myXmlElement1.SchemaType = myXmlSchemaComplexType;
myXmlSchema.Items.Add(myXmlElement1);

XmlSchemaElement myXmlElement2 = new XmlSchemaElement();
myXmlElement2.Name = "AddResponse";
myXmlSchemaComplexType = new XmlSchemaComplexType();
myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement(
   "1", "1", "AddResult", new XmlQualifiedName("s:float")));
                       
myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
myXmlElement2.SchemaType=myXmlSchemaComplexType;
myXmlSchema.Items.Add(myXmlElement2);

XmlSchemaElement myXmlElement3 = new XmlSchemaElement();
myXmlElement3.Name="Subtract";
myXmlSchemaComplexType = new XmlSchemaComplexType();
myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement(
   "1", "1", "a", new XmlQualifiedName("s:float")));
                                     
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement(
   "1", "1", "b", new XmlQualifiedName("s:float")));
                                      
myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
myXmlElement3.SchemaType=myXmlSchemaComplexType;
myXmlSchema.Items.Add(myXmlElement3);

XmlSchemaElement myXmlElement4 = new XmlSchemaElement();
myXmlElement4.Name="SubtractResponse";
myXmlSchemaComplexType = new XmlSchemaComplexType();
myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement(
   "1", "1", "SubtractResult", new XmlQualifiedName("s:int")));
                  
myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
myXmlElement4.SchemaType = myXmlSchemaComplexType;
myXmlSchema.Items.Add(myXmlElement4);

// Add the schemas to the Types property of the ServiceDescription.
myServiceDescription.Types.Schemas.Add(myXmlSchema);

[C++] 
myServiceDescription->Types->Schemas->Remove(
   myServiceDescription->Types->Schemas->Item[0]);
XmlSchema* myXmlSchema = new XmlSchema();
myXmlSchema->AttributeFormDefault = XmlSchemaForm::Qualified;
myXmlSchema->ElementFormDefault = XmlSchemaForm::Qualified;
myXmlSchema->TargetNamespace = myServiceDescription->TargetNamespace;

XmlSchemaElement* myXmlElement1 = new XmlSchemaElement();
myXmlElement1->Name=S"Add";

XmlSchemaComplexType* myXmlSchemaComplexType = 
   new XmlSchemaComplexType();
XmlSchemaSequence* myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence->Items->Add(CreateComplexTypeXmlElement(
   S"1", S"1", S"a", new XmlQualifiedName(S"s:float")));

myXmlSchemaSequence->Items->Add(CreateComplexTypeXmlElement(
   S"1", S"1", S"b", new XmlQualifiedName(S"s:float")));

myXmlSchemaComplexType->Particle = myXmlSchemaSequence;
myXmlElement1->SchemaType = myXmlSchemaComplexType;
myXmlSchema->Items->Add(myXmlElement1);

XmlSchemaElement* myXmlElement2 = new XmlSchemaElement();
myXmlElement2->Name = S"AddResponse";
myXmlSchemaComplexType = new XmlSchemaComplexType();
myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence->Items->Add(CreateComplexTypeXmlElement(
   S"1", S"1", S"AddResult", new XmlQualifiedName(S"s:float")));

myXmlSchemaComplexType->Particle = myXmlSchemaSequence;
myXmlElement2->SchemaType=myXmlSchemaComplexType;
myXmlSchema->Items->Add(myXmlElement2);

XmlSchemaElement* myXmlElement3 = new XmlSchemaElement();
myXmlElement3->Name=S"Subtract";
myXmlSchemaComplexType = new XmlSchemaComplexType();
myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence->Items->Add(CreateComplexTypeXmlElement(
   S"1", S"1", S"a", new XmlQualifiedName(S"s:float")));

myXmlSchemaSequence->Items->Add(CreateComplexTypeXmlElement(
   S"1", S"1", S"b", new XmlQualifiedName(S"s:float")));

myXmlSchemaComplexType->Particle = myXmlSchemaSequence;
myXmlElement3->SchemaType=myXmlSchemaComplexType;
myXmlSchema->Items->Add(myXmlElement3);

XmlSchemaElement* myXmlElement4 = new XmlSchemaElement();
myXmlElement4->Name=S"SubtractResponse";
myXmlSchemaComplexType = new XmlSchemaComplexType();
myXmlSchemaSequence = new XmlSchemaSequence();
myXmlSchemaSequence->Items->Add(CreateComplexTypeXmlElement(
   S"1", S"1", S"SubtractResult", new XmlQualifiedName(S"s:int")));

myXmlSchemaComplexType->Particle = myXmlSchemaSequence;
myXmlElement4->SchemaType = myXmlSchemaComplexType;
myXmlSchema->Items->Add(myXmlElement4);

// Add the schemas to the Types property of the ServiceDescription.
myServiceDescription->Types->Schemas->Add(myXmlSchema);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ServiceDescription Class | ServiceDescription Members | System.Web.Services.Description Namespace

Show: