SoapMessage.ContentType Property

 

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

Namespace:   System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public string ContentType { get; set; }

Property Value

Type: System.String

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

Exception Condition
InvalidOperationException

ContentType is accessed AfterSerialize or AfterDeserialize stages.

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.

myStreamWriter.WriteLine("The contents of HTTP Content-type header is:");
myStreamWriter.WriteLine("\t" + message.ContentType);

.NET Framework
Available since 1.1
Return to top
Show: