Exposes a means of generating client proxy classes for XML Web services.
For a list of all members of this type, see ServiceDescriptionImporter Members.
System.Object
System.Web.Services.Description.ServiceDescriptionImporter
[Visual Basic]
Public Class ServiceDescriptionImporter
[C#]
public class ServiceDescriptionImporter
[C++]
public __gc class ServiceDescriptionImporter
[JScript]
public class ServiceDescriptionImporter
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Example
[Visual Basic]
Imports System
Imports System.Web.Services.Description
Imports System.CodeDom
Namespace MyServiceDescription
Class MyImporter
Public Shared Sub Main()
Try
Dim myServiceDescription As ServiceDescription = ServiceDescription.Read _
("Sample_VB.wsdl")
Dim myImporter As New ServiceDescriptionImporter()
' Set the protocol.
myImporter.ProtocolName = "Soap"
myImporter.AddServiceDescription(myServiceDescription, "", "")
Console.WriteLine("Style: " + myImporter.Style.ToString())
Dim myNamespace As New CodeNamespace(ServiceDescription.Namespace)
Dim myUnit As New CodeCompileUnit()
myUnit.Namespaces.Add(myNamespace)
Dim myWarning As ServiceDescriptionImportWarnings = myImporter.Import _
(myNamespace, myUnit)
Console.WriteLine("ServiceDescriptionImportWarnings value generated: " + _
myWarning.ToString())
' Get the XMLSchema related to the ServiceDescriptionImporter.
Dim mySchema As System.Xml.Serialization.XmlSchemas = myImporter.Schemas
Catch e As Exception
Console.WriteLine("Following exception was thrown: " + e.ToString())
End Try
End Sub 'Main
End Class 'MyImporter
End Namespace 'MyServiceDescription
[C#]
using System;
using System.Web.Services.Description;
using System.CodeDom;
namespace MyServiceDescription
{
class MyImporter
{
public static void Main()
{
try
{
ServiceDescription myServiceDescription =
ServiceDescription.Read("Sample_CS.wsdl");
ServiceDescriptionImporter myImporter =
new ServiceDescriptionImporter();
// Set the protocol.
myImporter.ProtocolName = "Soap";
myImporter.AddServiceDescription(myServiceDescription, "", "");
Console.WriteLine("Style: " + myImporter.Style.ToString());
CodeNamespace myNamespace =
new CodeNamespace(ServiceDescription.Namespace);
CodeCompileUnit myUnit = new CodeCompileUnit();
myUnit.Namespaces.Add(myNamespace);
ServiceDescriptionImportWarnings myWarning =
myImporter.Import(myNamespace, myUnit);
Console.WriteLine("ServiceDescriptionImportWarnings value generated: "
+ myWarning.ToString());
// Get the XMLSchema related to the ServiceDescriptionImporter.
System.Xml.Serialization.XmlSchemas mySchema = myImporter.Schemas;
}
catch (Exception e)
{
Console.WriteLine("Following exception was thrown: "
+ e.ToString());
}
}
}
}
[C++]
#using <mscorlib.dll>
#using <System.Web.Services.dll>
#using <System.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::CodeDom;
int main()
{
try
{
ServiceDescription* myServiceDescription =
ServiceDescription::Read(S"Sample_cpp.wsdl");
ServiceDescriptionImporter* myImporter = new ServiceDescriptionImporter();
// Set the protocol.
myImporter->ProtocolName = S"Soap";
myImporter->AddServiceDescription(myServiceDescription, S"", S"");
Console::WriteLine(S"Style: {0}",__box( myImporter->Style));
CodeNamespace* myNamespace = new CodeNamespace(ServiceDescription::Namespace);
CodeCompileUnit* myUnit = new CodeCompileUnit();
myUnit->Namespaces->Add(myNamespace);
ServiceDescriptionImportWarnings myWarning =
myImporter->Import(myNamespace, myUnit);
Console::WriteLine(S"ServiceDescriptionImportWarnings value generated: {0}",
__box( myWarning));
// Get the XMLSchema related to the ServiceDescriptionImporter.
myImporter->Schemas;
}
catch (Exception* e)
{
Console::WriteLine(S"Following exception was thrown: {0}", e);
}
}
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Web.Services.Description
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Web.Services (in System.Web.Services.dll)
See Also
ServiceDescriptionImporter Members | System.Web.Services.Description Namespace