Skip to main content

Authentication and Headers


The base URI to access SOAP requests is:

The SOAPHeader Element

The SOAP header element contains application-specific information (like authentication) about the SOAP message. If the header element is present, it must be the first element in the envelope element.

Note: All immediate child elements of the header element must be namespace-qualified.

<s:Envelope xmlns:s="">
    <Action s:mustUnderstand="1" xmlns=""></Action>
      <h:AuthHeader xmlns="" xmlns:xsi="" xmlns:xsd="" xmlns:h="">
        <Date>Tue, 12 Aug 2014 14:18:50 GMT</Date>
  <s:Body xmlns:xsi="" xmlns:xsd="">
<GetReports xmlns="">

The mustUnderstand Attribute

The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process. It is mandatory to send a SOAPHeader to the WCF service. If you add mustUnderstand=“1” to a child element of the header element, it indicates that the receiver processing the header must recognize the element. If the receiver does not recognize the element, it will fail when processing the header.


soap: mustUnderstand = "0|1";


The AuthHeader is required to authenticate the login to the WCF web server. It is contained in the SoapHeader element for every request.

<xs:schema xmlns:xs="" xmlns="" xmlns:xsi="" elementFormDefault="qualified" targetNamespace="">
  <xs:element name="AuthHeader">
        <xs:element name="Authorization" type="xs:string"/>
        <xs:element name="Date" type="xs:string"/>

AuthHeader Elements

Element Definition Required
Authorization Y
Date Y

Creating AuthHeader

public AuthHeader AuthHeader
  AuthHeader header = null;
  if (!string.IsNullOrEmpty(APIKey))
    header = new AuthHeader();
    header.Date = DateTime.UtcNow.ToString(HEADER_TIMESTAMP_FORMAT); header.Authorization = APIKey;
    throw new PCMilerException("Could not generate AuthHeader. Not all values have been defined.");
  return header;

The Request Elements


Represents header information that is part of every web service request.


<xs:complexType name="RequestHeader">
    <xs:element minOccurs="0" name="DataVersion" nillable="true" type="xs:string"/>
    <xs:element minOccurs="0" name="RequestType" nillable="true" type="xs:string"/>
<xs:element name="RequestHeader" nillable="true" type="tns:RequestHeader"/>

RequestHeader Elements

Element Definition Required
DataVersion String value. The data version can be any version number, starting with PCM18, for users with access to multiple versions of PC*MILER. Set to “Current” for current quarter data. N
RequestType String value. The AboutService API requires this to be “AboutMapService”. All other APIs do not validate this and can be any string. N


ResponseHeader Elements

Element Definition
DataVersion A string. Gets or sets the data version used in the request operation.
Errors A list of Errors object<>. Gets or sets a collection of errors that may have occurred during the request operation.
Success A boolean value. Gets or sets the response type which is the same value that the user passed in for the request.
Type A string. Gets or sets the response type which is the same value that the user passed in for the request type.

Error Members

Element Definition
Code An enumeration of PcmwsExceptionCode. Gets or sets the data version used in the request operation.
Usage: var errCode = new ServiceReference.PcmwsExceptionCode();<br>errorCode = response.Header.Errors[0].Code;
Description A string. Gets or sets the detailed error description.
Usage: var description = response.Header.Errors[0].Description;
LegacyErrorCode An Integer. Gets or sets the legacy error code which is an integer valued code that would have been returned in PC*MILER Web Services V25 and earlier.
Usage: int Xresponse.Header.Errors[0].legacyErrorCode;
Type Gets or sets whether the error is an exception or a warning.
Usage: string type = response.Header.Errors[0].type;
Last updated November 23, 2021.