MimeXmlBinding 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示加入至 MimePart、InputBinding 或 OutputBinding 的擴充性項目。 它指定不是 SOAP 相容 (Compliant) 的 XML 訊息結構描述 (Schema)。 此類別無法獲得繼承。
public ref class MimeXmlBinding sealed : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("mimeXml", "http://schemas.xmlsoap.org/wsdl/mime/", typeof(System.Web.Services.Description.MimePart), typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))]
public sealed class MimeXmlBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("mimeXml", "http://schemas.xmlsoap.org/wsdl/mime/", typeof(System.Web.Services.Description.MimePart), typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))>]
type MimeXmlBinding = class
inherit ServiceDescriptionFormatExtension
Public NotInheritable Class MimeXmlBinding
Inherits ServiceDescriptionFormatExtension
- 繼承
- 屬性
範例
下列範例示範 類別的 MimeXmlBinding
一般用法。
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;
int main()
{
try
{
ServiceDescription^ myDescription = ServiceDescription::Read( "MimeXmlBinding_Part_3_Input_CPP.wsdl" );
// Create the 'Binding' object.
Binding^ myBinding = gcnew Binding;
// Initialize 'Name' property of 'Binding' class.
myBinding->Name = "MimeXmlBinding_Part_3_ServiceHttpPost";
XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeXmlBinding_Part_3_ServiceHttpPost" );
myBinding->Type = myXmlQualifiedName;
// Create the 'HttpBinding' object.
HttpBinding^ myHttpBinding = gcnew HttpBinding;
myHttpBinding->Verb = "POST";
// Add the 'HttpBinding' to the 'Binding'.
myBinding->Extensions->Add( myHttpBinding );
// Create the 'OperationBinding' object.
OperationBinding^ myOperationBinding = gcnew OperationBinding;
myOperationBinding->Name = "AddNumbers";
HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding;
myHttpOperationBinding->Location = "/AddNumbers";
// Add the 'HttpOperationBinding' to 'OperationBinding'.
myOperationBinding->Extensions->Add( myHttpOperationBinding );
// Create the 'InputBinding' object.
InputBinding^ myInputBinding = gcnew InputBinding;
MimeContentBinding^ myMimeContentBinding = gcnew MimeContentBinding;
myMimeContentBinding->Type = "application/x-www-form-urlencoded";
myInputBinding->Extensions->Add( myMimeContentBinding );
// Add the 'InputBinding' to 'OperationBinding'.
myOperationBinding->Input = myInputBinding;
// Create an OutputBinding.
OutputBinding^ myOutputBinding = gcnew OutputBinding;
MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding;
// Initialize the Part property of the MimeXmlBinding.
myMimeXmlBinding->Part = "Body";
// Add the MimeXmlBinding to the OutputBinding.
myOutputBinding->Extensions->Add( myMimeXmlBinding );
// Add the 'OutPutBinding' to 'OperationBinding'.
myOperationBinding->Output = myOutputBinding;
// Add the 'OperationBinding' to 'Binding'.
myBinding->Operations->Add( myOperationBinding );
// Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
myDescription->Bindings->Add( myBinding );
// Write the 'ServiceDescription' as a WSDL file.
myDescription->Write( "MimeXmlBinding_Part_3_Output_CPP.wsdl" );
Console::WriteLine( "WSDL file with name 'MimeXmlBinding_Part_3_Output_CPP.wsdl' is"
" created successfully." );
}
catch ( Exception^ e )
{
Console::WriteLine( "Exception: {0}", e->Message );
}
}
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;
class MyXmlBinding
{
public static void Main()
{
try
{
ServiceDescription myDescription =
ServiceDescription.Read("MimeXmlBinding_Part_3_Input_CS.wsdl");
// Create the 'Binding' object.
Binding myBinding = new Binding();
// Initialize 'Name' property of 'Binding' class.
myBinding.Name = "MimeXmlBinding_Part_3_ServiceHttpPost";
XmlQualifiedName
myXmlQualifiedName = new XmlQualifiedName("s0:MimeXmlBinding_Part_3_ServiceHttpPost");
myBinding.Type = myXmlQualifiedName;
// Create the 'HttpBinding' object.
HttpBinding myHttpBinding = new HttpBinding();
myHttpBinding.Verb="POST";
// Add the 'HttpBinding' to the 'Binding'.
myBinding.Extensions.Add(myHttpBinding);
// Create the 'OperationBinding' object.
OperationBinding myOperationBinding = new OperationBinding();
myOperationBinding.Name = "AddNumbers";
HttpOperationBinding myHttpOperationBinding = new HttpOperationBinding();
myHttpOperationBinding.Location="/AddNumbers";
// Add the 'HttpOperationBinding' to 'OperationBinding'.
myOperationBinding.Extensions.Add(myHttpOperationBinding);
// Create the 'InputBinding' object.
InputBinding myInputBinding = new InputBinding();
MimeContentBinding myMimeContentBinding = new MimeContentBinding();
myMimeContentBinding.Type="application/x-www-form-urlencoded";
myInputBinding.Extensions.Add(myMimeContentBinding);
// Add the 'InputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding;
// Create an OutputBinding.
OutputBinding myOutputBinding = new OutputBinding();
MimeXmlBinding myMimeXmlBinding = new MimeXmlBinding();
// Initialize the Part property of the MimeXmlBinding.
myMimeXmlBinding.Part="Body";
// Add the MimeXmlBinding to the OutputBinding.
myOutputBinding.Extensions.Add(myMimeXmlBinding);
// Add the 'OutPutBinding' to 'OperationBinding'.
myOperationBinding.Output = myOutputBinding;
// Add the 'OperationBinding' to 'Binding'.
myBinding.Operations.Add(myOperationBinding);
// Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
myDescription.Bindings.Add(myBinding);
// Write the 'ServiceDescription' as a WSDL file.
myDescription.Write("MimeXmlBinding_Part_3_Output_CS.wsdl");
Console.WriteLine("WSDL file with name 'MimeXmlBinding_Part_3_Output_CS.wsdl' is"
+ " created successfully.");
}
catch(Exception e)
{
Console.WriteLine( "Exception: {0}", e.Message );
}
}
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml
Class MyXmlBinding
Public Shared Sub Main()
Try
Dim myDescription As ServiceDescription = ServiceDescription.Read _
("MimeXmlBinding_Part_3_Input_VB.wsdl")
' Create the 'Binding' object.
Dim myBinding As New Binding()
' Initialize 'Name' property of 'Binding' class.
myBinding.Name = "MimeXmlBinding_Part_3_ServiceHttpPost"
Dim myXmlQualifiedName As New XmlQualifiedName("s0:MimeXmlBinding_Part_3_ServiceHttpPost")
myBinding.Type = myXmlQualifiedName
' Create the 'HttpBinding' object.
Dim myHttpBinding As New HttpBinding()
myHttpBinding.Verb = "POST"
' Add the 'HttpBinding' to the 'Binding'.
myBinding.Extensions.Add(myHttpBinding)
' Create the 'OperationBinding' object.
Dim myOperationBinding As New OperationBinding()
myOperationBinding.Name = "AddNumbers"
Dim myHttpOperationBinding As New HttpOperationBinding()
myHttpOperationBinding.Location = "/AddNumbers"
' Add the 'HttpOperationBinding' to 'OperationBinding'.
myOperationBinding.Extensions.Add(myHttpOperationBinding)
' Create the 'InputBinding' object.
Dim myInputBinding As New InputBinding()
Dim myMimeContentBinding As New MimeContentBinding()
myMimeContentBinding.Type = "application/x-www-form-urlencoded"
myInputBinding.Extensions.Add(myMimeContentBinding)
' Add the 'InputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding
' Create an OutputBinding.
Dim myOutputBinding As New OutputBinding()
Dim myMimeXmlBinding As New MimeXmlBinding()
' Initialize the Part property of the MimeXmlBinding.
myMimeXmlBinding.Part = "Body"
' Add the MimeXmlBinding to the OutputBinding.
myOutputBinding.Extensions.Add(myMimeXmlBinding)
' Add the 'OutPutBinding' to 'OperationBinding'.
myOperationBinding.Output = myOutputBinding
' Add the 'OperationBinding' to 'Binding'.
myBinding.Operations.Add(myOperationBinding)
' Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
myDescription.Bindings.Add(myBinding)
' Write the 'ServiceDescription' as a WSDL file.
myDescription.Write("MimeXmlBinding_Part_3_Output_VB.wsdl")
Console.WriteLine("WSDL file with name 'MimeXmlBinding_Part_3_Output_VB.wsdl' is" + _
" created successfully.")
Catch e As Exception
Console.WriteLine("Exception: {0}", e.Message)
End Try
End Sub
End Class
備註
如需指定 XML Web 服務的通訊協議的詳細資訊,請參閱 使用 ASP.NET 的 XML Web 服務。 如需 Web 服務描述語言 (WSDL) 的詳細資訊,請參閱 WSDL 規格。
建構函式
MimeXmlBinding() |
初始化 MimeXmlBinding 類別的新執行個體。 |
屬性
Handled |
取得或設定值,指出 ServiceDescriptionFormatExtension 是否在擴充性項目匯入時由匯入處理序來使用。 (繼承來源 ServiceDescriptionFormatExtension) |
Parent |
取得 ServiceDescriptionFormatExtension 的父系。 (繼承來源 ServiceDescriptionFormatExtension) |
Part |
取得或設定套用 MessagePart 的 MimeXmlBinding 的名稱。 |
Required |
取得或設定值,指出 ServiceDescriptionFormatExtension 對它所參考的動作是否是必要的。 (繼承來源 ServiceDescriptionFormatExtension) |
方法
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
GetType() |
取得目前執行個體的 Type。 (繼承來源 Object) |
MemberwiseClone() |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
ToString() |
傳回代表目前物件的字串。 (繼承來源 Object) |