Share via


CancelJobRequest element

The required CancelJobRequest element allows a client to cancel a print job.

CancelJobRequest 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:CancelJobRequest>
  child elements
</wprt:CancelJobRequest>

Attributes

There are no attributes.

Text value

None

Child elements

Element Description

JobId

Uniquely identifies a job on a printer.

Parent elements

There are no parent elements.

Remarks

The CancelJobRequest operation allows a client to cancel a print job from the time the job is created up to the time it is completed, canceled, or stopped. The JobId element contains the identifier of the job that the client is trying to cancel.

The WSD Print Service should move the specified job to the Canceled state if the job was at a Pending state or a Processing state. It is an error to attempt to cancel a completed or canceled job or to try to cancel any job that the client does not have rights to.

All the 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 error could also be returned from this operation:

  • ClientErrorJobIdNotFound

    The printer cannot find a job matching the JobId element, including when the element is not in the range of 1 to 2147483647 (231-1).

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

     

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 sample contains a request to cancel the job identified with a JobId of 1.

<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/CancelJob
    </wsa:Action>
    <wsa:MessageID>uuid:UniqueMsgId</wsa:MessageID>
  </soap:Header>
  <soap:Body>
    <wprt:CancelJobRequest>
      <wprt:JobId>1</wprt::JobId>
    </wprt:CancelJobRequest>
  </soap:Body>
</soap:Envelope>

See also

Common Operation Error Codes

CancelJobResponse

JobId

Operation Error Reporting

 

 

Send comments about this topic to Microsoft

Build date: 7/19/2012