MimePart 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示已加入至 MimeMultipartRelatedBinding 的擴充性項目,為 MessagePart 指定要套用 MimePart
的具體 MIME 類型。 此類別無法獲得繼承。
public ref class MimePart sealed : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class MimePart : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type MimePart = class
inherit ServiceDescriptionFormatExtension
Public NotInheritable Class MimePart
Inherits ServiceDescriptionFormatExtension
- 繼承
- 屬性
範例
下列範例示範如何使用 類別所 MimePart
公開的方法和屬性。
#using <System.Web.Services.dll>
#using <System.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Xml;
using namespace System::Web::Services::Description;
int main()
{
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePart_3_Input_cpp.wsdl" );
ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection;
myServiceDescriptionCol->Add( myServiceDescription );
XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" );
// Create the Binding.
Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName );
OperationBinding^ myOperationBinding = nullptr;
for ( int i = 0; i < myBinding->Operations->Count; i++ )
{
if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) )
{
myOperationBinding = myBinding->Operations[ i ];
}
}
// Create the OutputBinding.
OutputBinding^ myOutputBinding = myOperationBinding->Output;
MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding;
myMimeXmlBinding->Part = "body";
// Create the MimePart.
MimePart^ myMimePart = gcnew MimePart;
myMimePart->Extensions->Add( myMimeXmlBinding );
MimeMultipartRelatedBinding^ myMimePartRelatedBinding = gcnew MimeMultipartRelatedBinding;
// Add the MimePart to the MimePartRelatedBinding.
myMimePartRelatedBinding->Parts->Add( myMimePart );
myOutputBinding->Extensions->Add( myMimePartRelatedBinding );
myServiceDescription->Write( "MimePart_3_Output_CPP.wsdl" );
Console::WriteLine( "MimePart_3_Output_CPP.wsdl has been generated successfully." );
}
using System;
using System.Xml;
using System.Web.Services.Description;
public class MyMimePart
{
public static void Main()
{
ServiceDescription myServiceDescription =
ServiceDescription.Read("MimePart_3_Input_cs.wsdl");
ServiceDescriptionCollection myServiceDescriptionCol =
new ServiceDescriptionCollection();
myServiceDescriptionCol.Add(myServiceDescription);
XmlQualifiedName myXmlQualifiedName =
new XmlQualifiedName("MimeServiceHttpPost","http://tempuri.org/");
// Create the Binding.
Binding myBinding =
myServiceDescriptionCol.GetBinding(myXmlQualifiedName);
OperationBinding myOperationBinding= null;
for(int i=0; i< myBinding.Operations.Count; i++)
{
if(myBinding.Operations[i].Name.Equals("AddNumbers"))
{
myOperationBinding = myBinding.Operations[i];
}
}
// Create the OutputBinding.
OutputBinding myOutputBinding = myOperationBinding.Output;
MimeXmlBinding myMimeXmlBinding = new MimeXmlBinding();
myMimeXmlBinding.Part = "body";
// Create the MimePart.
MimePart myMimePart = new MimePart();
myMimePart.Extensions.Add(myMimeXmlBinding);
MimeMultipartRelatedBinding myMimePartRelatedBinding =
new MimeMultipartRelatedBinding();
// Add the MimePart to the MimePartRelatedBinding.
myMimePartRelatedBinding.Parts.Add(myMimePart);
myOutputBinding.Extensions.Add(myMimePartRelatedBinding);
myServiceDescription.Write("MimePart_3_Output_CS.wsdl");
Console.WriteLine(
"MimePart_3_Output_CS.wsdl has been generated successfully.");
}
}
Imports System.Xml
Imports System.Web.Services.Description
Public Class MyMimePart
Public Shared Sub Main()
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("MimePart_3_Input_vb.wsdl")
Dim myServiceDescriptionCol As New ServiceDescriptionCollection()
myServiceDescriptionCol.Add(myServiceDescription)
Dim myXmlQualifiedName As _
New XmlQualifiedName("MimeServiceHttpPost", "http://tempuri.org/")
' Create the Binding.
Dim myBinding As Binding = _
myServiceDescriptionCol.GetBinding(myXmlQualifiedName)
Dim myOperationBinding As OperationBinding = Nothing
Dim i As Integer
For i = 0 To myBinding.Operations.Count - 1
If myBinding.Operations(i).Name.Equals("AddNumbers") Then
myOperationBinding = myBinding.Operations(i)
End If
Next i
' Create the OutputBinding.
Dim myOutputBinding As OutputBinding = myOperationBinding.Output
Dim myMimeXmlBinding As New MimeXmlBinding()
myMimeXmlBinding.Part = "body"
' Create the MimePart.
Dim myMimePart As New MimePart()
myMimePart.Extensions.Add(myMimeXmlBinding)
Dim myMimePartRelatedBinding As New MimeMultipartRelatedBinding()
' Add the MimePart to the MimePartRelatedBinding.
myMimePartRelatedBinding.Parts.Add(myMimePart)
myOutputBinding.Extensions.Add(myMimePartRelatedBinding)
myServiceDescription.Write("MimePart_3_Output_vb.wsdl")
Console.WriteLine( _
"MimePart_3_Output_vb.wsdl has been generated successfully.")
End Sub
End Class
備註
如需指定 XML Web 服務的通訊協議的詳細資訊,請參閱 使用 ASP.NET 的 XML Web 服務。 如需 Web 服務描述語言 (WSDL) 的詳細資訊,請參閱 WSDL 規格。
建構函式
MimePart() |
初始化 MimePart 類別的新執行個體。 |
屬性
Extensions |
取得 MimeMultipartRelatedBinding (MimePart 為其成員) 各部分之 MIME 擴充性項目的集合。 |
Handled |
取得或設定值,指出 ServiceDescriptionFormatExtension 是否在擴充性項目匯入時由匯入處理序來使用。 (繼承來源 ServiceDescriptionFormatExtension) |
Parent |
取得 ServiceDescriptionFormatExtension 的父系。 (繼承來源 ServiceDescriptionFormatExtension) |
Required |
取得或設定值,指出 ServiceDescriptionFormatExtension 對它所參考的動作是否是必要的。 (繼承來源 ServiceDescriptionFormatExtension) |
方法
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
GetType() |
取得目前執行個體的 Type。 (繼承來源 Object) |
MemberwiseClone() |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
ToString() |
傳回代表目前物件的字串。 (繼承來源 Object) |