MimePart Class
Represents an extensibility element added to a MimeMultipartRelatedBinding, specifying the concrete MIME type for the MessagePart to which the MimePart applies. This class cannot be inherited.
Assembly: System.Web.Services (in System.Web.Services.dll)
For more information about specifying protocols for XML Web services, see [<topic://cpconbuildingaspnetwebservices>]. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.
The following example demonstrates the use of the methods and properties exposed by the MimePart class.
#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 <mscorlib.dll>
#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(S"MimePart_3_Input_cs.wsdl");
ServiceDescriptionCollection* myServiceDescriptionCol =
new ServiceDescriptionCollection();
myServiceDescriptionCol->Add(myServiceDescription);
XmlQualifiedName* myXmlQualifiedName =
new XmlQualifiedName(S"MimeServiceHttpPost",S"http://tempuri.org/");
// Create the Binding.
Binding* myBinding =
myServiceDescriptionCol->GetBinding(myXmlQualifiedName);
OperationBinding* myOperationBinding= 0;
for(int i=0; i< myBinding->Operations->Count; i++)
{
if(myBinding->Operations->Item[i]->Name->Equals(S"AddNumbers"))
{
myOperationBinding = myBinding->Operations->Item[i];
}
}
// Create the OutputBinding.
OutputBinding* myOutputBinding = myOperationBinding->Output;
MimeXmlBinding* myMimeXmlBinding = new MimeXmlBinding();
myMimeXmlBinding->Part = S"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(S"MimePart_3_Output_CS.wsdl");
Console::WriteLine(
S"MimePart_3_Output_CS.wsdl has been generated successfully.");
}
System.Web.Services.Description::ServiceDescriptionFormatExtension
System.Web.Services.Description::MimePart
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.