AddDocumentRequest element

The required AddDocumentRequest element submits the URL reference associated with a document to the printer for printing.

AddDocumentRequest is defined in the namespace at this URI: https://schemas.microsoft.com/windows/2005/05/wdp/print and referenced by the prefix wprt. (This resource may not be available in some languages and countries.)

Usage

<wprt:AddDocumentRequest>
  child elements
</wprt:AddDocumentRequest>

Attributes

There are no attributes.

Text value

None

Child elements

Element Description

DocumentDescription

Describes all attributes associated with the basic creation of the current document.

DocumentProcessing

Contains the requested processing attributes that are applicable at the document level.

DocumentUrl

Contains the URL to document data for a document to be printed by reference.

JobId

Uniquely identifies a job on a printer.

LastDocument

Specifies whether more documents will be submitted for the current print job.

Parent elements

There are no parent elements.

Remarks

The WSD Print Service can optionally support the AddDocumentRequest operation.

AddDocumentRequest is nearly identical to the SendDocumentRequest operation except that the client supplies a URL reference to the document instead of supplying the document data. AddDocumentRequest is the next step in submitting a URL-referenced job to the printer after the CreatePrintJobRequest operation.

One or more AddDocumentRequest operations can be used to send the print data to the print service. Each AddDocumentRequest contains the job ID of the job to which the document should be attached. If a printer does not support multi-document jobs, only one AddDocumentRequest or AddDocumentRequest operation should follow each CreatePrintJobRequest operation, and the LastDocument child element of AddDocumentRequest should be set to 1 (true).

If the DocumentProcessing element is present, its parameters override any DocumentProcessing parameters set during the CreatePrintJobRequest operation. The override is valid for the current document only.

The PrinterCapabilities element returned in a GetPrinterElementsResponse element contains the values of the arguments that the printer supports for a job creation operation. The WSD Print Service should do the following validation, in order, on the DocumentDescription element to ensure that the client has selected valid description values from PrinterCapabilities:

  • If the Format element is not supported, the WSD Print Service must reject the AddDocumentRequest operation and return the ClientErrorDocumentFormatNotSupported error code.
  • If the Compression element is not supported, the Print Service must reject the request and return the ClientErrorCompressionNotSupported error code.

All codes described in Common Operation Error Codes could be returned from this operation. See Operation Error Reporting for details on how to report errors. The following errors could also be returned from this operation.

  • ServerErrorAddDocumentNotSupported

    The WSD Print Service does not support retrieving document data by a URL reference.

    Fault Property Property Definition
    [Code] soap:Receiver
    [Subcode] wprt:ServerErrorAddDocumentNotSupported
    [Reason] Print Service does not support the AddDocument operation
    [Detail] None

     

  • ClientErrorJobIdNotFound

    The printer cannot find a job matching the JobId element (including when the JobId element is not in the range: 1 to 2147483648 [231-1]).

    Fault Property Property Definition
    [Code] soap:Sender
    [Subcode] wprt:ClientErrorJobIdNotFound
    [Reason] Specified JobId not found
    [Detail] Incorrect JobId

     

  • ClientErrorMultipleDocumentsNotSupported

    The printer does not support jobs that contain more than one document. If the LastDocument element of the document is not 1 (true) for the first document of the job, this error is returned.

    Fault Property Property Definition
    [Code] soap:Sender
    [Subcode] wprt:ClientErrorMultipleDocumentsNotSupported
    [Reason] Print Service does not support jobs with multiple documents
    [Detail] None

     

  • ClientErrorLastDocumentAlreadySent

    The printer has already received a document with the LastDocument element set to 1 (true).

    Fault Property Property Definition
    [Code] soap:Sender
    [Subcode] wprt:ClientErrorLastDocumentAlreadySent
    [Reason] LastDocument already received for specified JobId
    [Detail] None

     

  • ServerErrorNotAcceptingJobs

    The server can't accept a new print job. This could occur because the printer has been put into service mode, or there is a user intervention condition and all the memory buffers have been exhausted. The client can try the unmodified request again at some later point in time with an expectation that the server has become unblocked and the printer is accepting jobs again.

    Fault Property Property Definition
    [Code] soap:Receiver
    [Subcode] wprt:ServerErrorNotAcceptingJobs
    [Reason] The service is temporarily blocked and can't accept new job or document requests
    [Detail] None

     

  • ServerErrorJobCancelled

    The job associated with this document is canceled while the document data is being transferred.

    Fault Property Property Definition
    [Code] soap:Receiver
    [Subcode] wprt:ServerErrorJobCancelled
    [Reason] Job which this document is a part of has been canceled
    [Detail] None

     

  • ClientErrorFormatNotSupported

    The supplied Format value is not supported by the printer.

    Fault Property Property Definition
    [Code] soap:Sender
    [Subcode] wprt:ClientErrorFormatNotSupported
    [Reason] Document Format parameter value not supported
    [Detail] Optional: The Printer Service can return a list of supported formats.

     

  • ClientErrorCompressionNotSupported

    The supplied Compression value is not supported by the printer.

    Fault Property Property Definition
    [Code] soap:Sender
    [Subcode] wprt:ClientErrorCompressionNotSupported
    [Reason] Compression parameter value not supported
    [Detail] Optional: Could return a list of supported compression values

     

  • ClientErrorDocumentURLSchemeNotSupported

    The Print Service does not support the scheme specified in the DocumentUrl element.

    Fault Property Property Definition
    [Code] soap:Sender
    [Subcode] wprt:ClientErrorDocumentURLSchemeNotSupported
    [Reason] Print Service does not support the specified URL scheme
    [Detail] Optional: Could return a list of supported schemes

     

  • ClientErrorDocumentURLNotFound

    The DocumentUrl text value could not be resolved to a valid resource. The main reason for this would be that the resource identifier is incorrect; however, this could also indicate that the printer could not establish a path to the resource.

    Fault Property Property Definition
    [Code] soap:Sender
    [Subcode] wprt:ClientErrorDocumentURLNotFound
    [Reason] The DocumentUrl specified does not resolve to a valid resource
    [Detail] None

     

In the following example code, note that you must also prefix the names of the child and other elements with the appropriate namespace to be certain that your name references apply to elements in the correct namespace.

Examples

The following code example points to the URL that specifies the document to be retrieved and printed by the printer.

<soap:Envelope
    xmlns:soap="https://www.w3.org/2003/05/soap-envelope"
    xmlns:wsdp="https://schemas.xmlsoap.org/ws/2005/05/devprof"
    xmlns:wsa="https://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wprt="https://schemas.microsoft.com/windows/2005/05/wdp/print">
    soap:encodingStyle='https://www.w3.org/2002/12/soap-encoding' >
  <soap:Header>
    <wsa:To>uuid:DeviceUUID</wsa:To>
    <wsdp:ServiceId>uri:IdofThisService</wsdp:ServiceId>
    <wsa:Action>
      https://schemas.microsoft.com/windows/2005/05/wdp/print/AddDocument
    </wsa:Action>
    <wsa:MessageID>uuid:UniqueMsgId</wsa:MessageID>
  </soap:Header>
  <soap:Body>
    <wprt:AddDocumentRequest>
      <wprt:JobId>1</wprt:JobId>
      <wprt:DocumentDescription>
        <wprt:DocumentId>1</wprt:DocumentId>
        <wprt:Compression>None</wprt:Compression>
        <wprt:Format>application/octet-stream</wprt:Format>
        <wprt:DocumentName>Example.xml</wprt:DocumentName>
      </wprt:DocumentDescription>
      <wprt:DocumentProcessing>
        <wprt:NumberUp>
          <wprt:PagesPerSheet>2</wprt:PagesPerSheet>
          <wprt:Direction>RightDown</wprt:Direction>
        </wprt:NUmberUp>
      </wprt:DocumentProcessing>
      <wprt:LastDocument>true</wprt:LastDocument>
      <wprt:DocumentUrl>
        https://www.example.com/PrintJobs/ExamplePrint.ps
      </wprt:DocumentUrl>
    </wprt:AddDocumentRequest>
  </soap:Body>
</soap:Envelope>

See also

AddDocumentResponse

CreatePrintJobRequest

DocumentDescription

DocumentProcessing

DocumentUrl

JobId

LastDocument

MediaSizeName

MediaType Element for parent DocumentProcessing

PrinterCapabilities

SendDocumentRequest

 

 

Send comments about this topic to Microsoft

Build date: 7/19/2012