SoapMessage.ContentType Property

Definition

Gets or sets the HTTP Content-Type of the SOAP request or SOAP response.

public:
 property System::String ^ ContentType { System::String ^ get(); void set(System::String ^ value); };
public string ContentType { get; set; }
member this.ContentType : string with get, set
Public Property ContentType As String

Property Value

The HTTP Content-Type of the SOAP request or SOAP response. The default is "text/xml".

Exceptions

Examples

myStreamWriter->WriteLine( "The contents of HTTP Content-type header is:" );
myStreamWriter->WriteLine( "\t{0}", message->ContentType );
myStreamWriter.WriteLine("The contents of HTTP Content-type header is:");
myStreamWriter.WriteLine("\t" + message.ContentType);
myStreamWriter.WriteLine("The contents of HTTP Content-type header is:")
myStreamWriter.WriteLine(ControlChars.Tab & message.ContentType)

Remarks

The ContentType property can only be accessed in the BeforeSerialize and BeforeDeserialize stages; otherwise, an InvalidOperationException is thrown.

Use the ContentEncoding property, instead of the ContentType property to provide supplementary information about the encoding of a SOAP message.

Applies to

See also