SoapMessage.ContentType Property

Definition

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

C#
public string ContentType { get; set; }

Property Value

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

Exceptions

Examples

C#
myStreamWriter.WriteLine("The contents of HTTP Content-type header is:");
myStreamWriter.WriteLine("\t" + 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

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also