MimePart 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示添加到 MimeMultipartRelatedBinding 的扩展性元素,指定 MimePart
所应用于的 MessagePart 的具体 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 服务指定协议的详细信息,请参阅 XML Web Services Using ASP.NET。 有关 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) |