Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services for Devices Install: Printers & Scanners

Similar presentations


Presentation on theme: "Web Services for Devices Install: Printers & Scanners"— Presentation transcript:

1 Web Services for Devices Install: Printers & Scanners
Mike Fenelon Software Developer Digital Documents, Platform and Solutions Team microsoft.com Microsoft Corporation

2 Printing with Web Services for Devices

3 Printer Installation Step-By-Step
Spooler PnP-Printer Class Installer WSD Port Monitor 1 8 8 11 11 Function Discovery (FD) Print Device PDO 9 9 7 4 4 3 7 Print Service FDO WS-Discovery Provider IPBusEnumerator 6 6 5 5 2 10 User-Mode Enabled Bus Enumerator (UMBus)

4 Step 1- WSD Port Monitor Initialization
Spooler starts up WSD Port Monitor (WSDMon) queries FD for all existing WSD print devices and creates the appropriate ports Any new devices found while the spooler wasn’t running will also kick off PnP installation for the Print Object (Step 9) WSDMon will also register for notifications on the correct FD category to receive future device notifications Spooler WSD Port Monitor 1 Function Discovery (FD)

5 Steps 2 & 3 – Printer Announcement and Discovery
Printer announces presence on the network by a WS-Discovery “Hello” message or responds to a Probe message from user opening Computers & Devices WS-Discovery provider recognizes the device and publishes it to Function Discovery (FD) Device Instance in FD contains all the basic device Metadata Device enabled for install if it contains PnP-X related metadata Function Discovery (FD) 3 WS-Discovery Provider 2

6 Steps 4 & 5 – Notification from FD and Devnode Creation
From Within Computers & Devices the User adds/installs discovered device to Association Database IPBusEnum gets a notification of the newly associated Network Device IPBusEnum reads data from the new instance and uses the COM interface to the User-Mode Enabled Bus Enumerator (UMBus) to tell UMBus to create a new WS Print Service DevNode Function Discovery (FD) 4 IPBusEnumerator 5 User-Mode Enabled Bus Enumerator (UMBus)

7 Step 6 – Create Printer Service Devnode
UMBus creates a File Device Object (FDO) for the WS-based Printer Service This FDO has a HardwareID & CompatibleId based on data from the Device Relationship Metadata <pnpx:HardwareId> <pnpx:CompatibleId> Scan Service FDO 6 User-Mode Enabled Bus Enumerator (UMBus)

8 Steps 7 & 8 – Print Service PnP Notification to FD and WSDMon
FD gets PnP notification of the new WS-Printer Service device object FD adds device to the correct category/subcategory and creates notification which is picked up by WSDMon Spooler WSD Port Monitor 8 Function Discovery (FD) 7 Print Service FDO

9 User-Mode Enabled Bus Enumerator (UMBus)
Step 9 – GetMetadata WSDMon activates the WS PrintProxy via the FD function instance and gets needed information from the device Uses GetMetadata calls or Print Service methods Gets device 1284 ID and determines port name WSDMon calls UMBus with info needed to create a Print Device Physical Device Object (PDO) in RAW mode This gets PnP started installing the Print Object in the spooler (Printers and Faxes folder) Spooler WSD Port Monitor 9 User-Mode Enabled Bus Enumerator (UMBus)

10 Steps 10 & 11 – PDO Creation and Driver Install
UMBus creates a Print Device PDO This PDO contains the Hardware ID, PortName, PrinterName, Location and comment field of the associated printer PnP searches installed INFs to find an INF that matches If no INF is found the Found New Hardware Wizard (FNHM) starts If an INF is found (or selected in the FNHW) PnP invokes the associated class installer, in this case the Printer Class Installer Install continues just like local PnP using the supplied information from the Print Device PDO to complete the installation PnP-Printer Class Installer 11 Print Device PDO 10 User-Mode Enabled Bus Enumerator (UMBus)

11 Printing Operation Step By Step
Driver B WSD Port Monitor D C App E F G Spooler Queue View

12 Step A & B – Driver Initialization
Bi-di enabled Driver queries device for configuration Driver uses Bi-di schema to request device configuration WSD Port Monitor uses GetPrinterElements operation to retrieve data from printer WSDMon converts XML data to Bi-di Schema responses A WSD Port Monitor B

13 Step C – Application prints a document
Application uses DevCaps to get accurate device capabilities Application formats the document based on current device capabilities Application begins rendering the document App C WSD Port Monitor

14 Step D & E – WSD Port Monitor prints a document
WSDMon sends CreatePrintJob operation to prepare device for print data CreatePrintJob response contains device JobID On first WritePort call WSDMon creates SendDocument opreation Device JobID and Job data transferred as part of SendDocument operation using MTOM WSD Port Monitor D E

15 Step F & G – JobEndState Event and Rich Status
Printer send JobEndState event when the print job finishes WSD Port Monitor creates Rich Status notification based on information in the event Job Status in Queue View is updated after SetJob call Queue View F WSD Port Monitor G

16 Scanning with Web Services for Devices

17 Scanner Installation Step By Step
WIA Service WSD Scan Driver 1 Function Discovery (FD) 8 4 4 3 WS-Discovery Provider Scan Service FDO IPBusEnumerator 6 6 5 5 2 User-Mode Enabled Bus Enumerator (UMBus)

18 Step 1 – WIA Service and Scan Class Driver Initialization
WIA Service starts up or User starts a WIA application WIA Service queries PnP for all existing Scan devices and creates the appropriate objects (Step 8) WIA Service WSD Scan Driver 1 Function Discovery (FD)

19 Steps 2 & 3 – Scanner Announcement and Discovery
Scanner announces presence on the network by a WS-Discovery “Hello” message or responds to a Probe message from user opening Computers & Devices WS-Discovery provider recognizes the device and publishes it to Function Discovery (FD) Device Instance in FD contains all the basic device Metadata Device enabled for install if it contains PnP-X related metadata Function Discovery (FD) 3 WS-Discovery Provider 2

20 Steps 4 & 5 – Notification from FD and Devnode Creation
From Within Computers & Devices the User adds/installs discovered device to Association Database IPBusEnum gets a notification of the newly associated Network Device IPBusEnum reads data from the new instance and uses the COM interface to the User-Mode Enabled Bus Enumerator (UMBus) to tell UMBus to create a new WS Print Service DevNode Function Discovery (FD) 4 IPBusEnumerator 5 User-Mode Enabled Bus Enumerator (UMBus)

21 Steps 6 – Create Scanner Service Devnode
UMBus creates a File Device Object (FDO) for the WS-based Scanner Service This FDO has a HardwareID & CompatibleId based on data from the Device Relationship Metadata <pnpx:HardwareId> <pnpx:CompatibleId> Scan Service FDO 6 User-Mode Enabled Bus Enumerator (UMBus)

22 Step 7 – PnP Notification and WSD Scan Driver Object Initialization
WIA Service gets PnP notification of the new WS-Scanner Service device object WIA creates a unique identifier for the device WSD Scan Driver instance is loaded for the new scanner Scan Service Function Instance is activated and the ScanProxy DLL is loaded Scanner installation is complete! WIA Service WSD Scan Driver 7 Scan Service FDO

23 Scanning Operation in the Home - Step By Step
WSD Scan Driver C B D WIA Service

24 Step A – PC Registers with Scanner
At scan object creation the PC creates scan destination(s) in the scan device Assigns device a unique identifier Subscribes for ScanAvailableEvent with wscn:ScanDestinations extension operation to set display name for current PC Receives scan context from device WIA Service WSD Scan Driver A

25 Steps B & C – User Initiates Scan
User selects destination from device display panel User presses scan button Device sends a ScanAvailableEvent to selected PC Event contains scanner identifier and scan context WIA Service WSD Scan Driver C Note: this could also be initiated from an application on the PC if scanner doesn’t have LCD or multi-PC capability B

26 Step D – Client Scans From Device
Client uses CreateScanJob & RetreiveImage operations to initiate scan and retrieve scan data Scan ticket in CreateScanJob operation contains desired scanning parameters Scan data is retrieved as part of the RetrieveImage operation response in any form using MTOM WIA Service WSD Scan Driver D

27 XML Messages for Printing

28 GetPrinterElements Request Example
<SOAP:Envelope xmlns:SOAP=" xmlns:SOAP-ENC=" xmlns:xsi=" xmlns:xsd=" xmlns:wprt=" <SOAP:Header> <wsa:Action> </wsa:Action> --- Header removed for Brevity --- </SOAP:Header <SOAP:Body> <wprt:GetPrinterElementsRequest> <wprt:RequestedElements> <wprt:Name>wprt:PrinterConfiguration</wprt:Name> </wprt:RequestedElements> </wprt:GetPrinterElementsRequest > </SOAP:Body> </SOAP:Envelope>

29 GetPrinterElements Response Example
<SOAP:Envelope xmlns:SOAP=" xmlns:SOAP-ENC=" xmlns:xsi=" xmlns:xsd=" xmlns:wprt=" <SOAP:Header> <wsa:Action> </wsa:Action> --- Header removed for Brevity --- </SOAP:Header <SOAP:Body> <wprt:GetPrinterElementsResponse> . </wprt:GetPrinterElementsResponse> </SOAP:Body> </SOAP:Envelope>

30 CreatePrintJob Request Example
<SOAP:Envelope xmlns:SOAP=" xmlns:SOAP-ENC=" xmlns:xsi=" xmlns:xsd=" xmlns:wprt=" <SOAP:Header> <wsa:Action> </wsa:Action> --- Header removed for Brevity --- </SOAP:Header <SOAP:Body> <wprt:CreatePrintJobRequest> . </wprt:CreatePrintJobRequest> </SOAP:Body> </SOAP:Envelope>

31 CreatePrintJob Response Example
<SOAP:Envelope xmlns:SOAP=" xmlns:SOAP-ENC=" xmlns:xsi=" xmlns:xsd=" xmlns:wprt=" <SOAP:Header> <wsa:Action> </wsa:Action> --- Header removed for Brevity --- </SOAP:Header <SOAP:Body> <wprt:CreatePrintJobResponse> . </wprt:CreatePrintJobResponse> </SOAP:Body> </SOAP:Envelope>

32 SendDocument Request Example
mime-version: 1.0 Content-Type: multipart/related; type=application/xop+xml; boundary=“--=_NextPart_123_321_ E9F5D”; start=”<OperationRequest>”; startinfo=application/soap+xml ----=_NextPart_123_321_ E9F5D Content-Type: application/xop+xml; type=application/soap_xop+xml charset=UTF-8 Content-Transfer-Encoding: binary Content-ID: <OperationRequest> <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap=" xmlns:wsdp=" xmlns:wsa=" xmlns:wprt=" xmlns:xmlmime=’ xmlns:xop=’ soap:encodingStyle=' > <soap:Header> <wsa:To>uuid:DeviceUUID</wsa:To> <wsdp:ServiceId>uri:IdofThisService</wsdp:ServiceId> <wsa:Action> </wsa:Action> <wsa:MessageID>uuid:UniqueMsgId</wsa:MessageID> </soap:Header>

33 SendDocument Request Example (cont.)
<soap:Body> <wprt:SendDocumentRequest> <wprt:JobId>IdFromCreateJobRequest</wprt:JobId> <wprt:DocumentDescription> <wprt:DocumentId>DocIdNumber</wprt:DocumentId> <wprt:Compression>None</wprt:Compression> <wprt:DocumentFormat> application/octet-stream</wprt:DocumentFormat> <wprt:DocumentName>Example.xml</wprt:DocumentName> </wprt:DocumentDescription> <wprt:LastDocument>true</wprt:LastDocument> <wprt:DocumentData xmlmime:contentType=”application/postscript”> <xop:Include href=”cid:000001” /> </wprt:DocumentData> </wprt:SendDocumentRequest> </soap:Body> </soap:Envelope> ----=_NextPart_123_321_ E9F5D Content-Type: application/postscript; Content-Transfer-Encoding: binary Content-ID: <000001> Document PDL Data ----=_NextPart_123_321_ E9F5D--

34 SendDocument Response Example
<SOAP:Envelope xmlns:SOAP=" xmlns:SOAP-ENC=" xmlns:xsi=" xmlns:xsd=" xmlns:wprt=" <SOAP:Header> <wsa:Action> </wsa:Action> --- Header removed for Brevity --- </SOAP:Header <SOAP:Body> <wprt:SendDocumentResponse/> </SOAP:Body> </SOAP:Envelope>

35 XML Messages for Scanning

36 Subscribe Request Example
<soap:Envelope xmlns:soap=" xmlns:wsa=" xmlns:wse=" xmlns:wsdp=" xmlns:wscn=" <soap:Header> <wsa:Action> <wsdp:ServiceId>uri:scn</wsdp:ServiceId> --- Headers removed for Brevity --- </soap:Header> <soap:Body> <wse:Subscribe> <wse:Delivery Mode=" <wse:NotifyTo> <wsa:Address> </wsa:Address> </wse:NotifyTo> </wse:Delivery> <wse:Expires>PT10M</wse:Expires> <wse:Filter Dialect=" </wse:Filter> <wscn:ScanDestinations> <wscn:ScanDestination> <wscn:ClientDisplayName>Scan to MFenelon2L</wscn:ClientDisplayName> <wscn:ClientContext>Scan</wscn:ClientContext> </wscn:ScanDestination> <wscn:ClientDisplayName>Scan for Print to MFenelon2L</wscn:ClientDisplayName> <wscn:ClientContext>ScanToPrint</wscn:ClientContext> </wscn:ScanDestinations> </wse:Subscribe> </soap:Body> </soap:Envelope>

37 Subscribe (ScanAvailableEvent) Response Example
<soap:Envelope xmlns:soap=" xmlns:wsa=" xmlns:wse=" xmlns:wsdp=" xmlns:wscn=" <soap:Header> <wsa:Action> --- Headers removed for Brevity --- </soap:Header> <soap:Body> <wse:SubscribeResponse> <wse:SubscriptionManager> <wsa:Address> <wsa:ReferenceProperties> <wsdp:ServiceId>uri:scn</wsdp:ServiceId> <wse:Identifier>uuid:0c27676b-e d d</wse:Identifier> </wsa:ReferenceProperties> </wse:SubscriptionManager> <wse:Expires>PT9M S</wse:Expires> <wscn:DestinationResponses> <wscn:DestinationResponse> <wscn:ClientContext>Scan</wscn:ClientContext> <wscn:DestinationToken>113527a bd6c-9c95d302c454</wscn:DestinationToken> </wscn:DestinationResponse> <wscn:ClientContext>ScanToPrint</wscn:ClientContext> <wscn:DestinationToken>6fcbbc0f-c035-41ca-a912-f6961a2e2257</wscn:DestinationToken> </wscn:DestinationResponses> </wse:SubscribeResponse> </soap:Body> </soap:Envelope>

38 ScanAvailableEvent Example
<soap:Envelope xmlns:soap=" xmlns:wsa=" xmlns:wscn=" <soap:Header> <wsa:To> </wsa:To> <wsa:Action> </wsa:Action> </soap:Header> <soap:Body> <wscn:ScanAvailableEvent> <wscn:ClientContext>Scan</wscn:ClientContext> <wscn:ScanIdentifier> a74dc73c-34b6-4e99-a724-c006f4625b68 </wscn:ScanIdentifier> </wscn:ScanAvailableEvent> </soap:Body> </soap:Envelope>

39 CreateScanJob Request Example
<soap:Envelope xmlns:soap=" xmlns:wsa=" xmlns:wsdp=" xmlns:wscn=" <soap:Header> <wsa:To> <wsa:Action> </wsa:Action> <wsdp:ServiceId>uri:scn</wsdp:ServiceId> --- Headers removed for Brevity --- </soap:Header> <soap:Body> <wscn:CreateScanJobRequest> <wscn:ScanIdentifier> a74dc73c-34b6-4e99-a724-c006f4625b68</wscn:ScanIdentifier> <wscn:DestinationToken> 113527a bd6c-9c95d302c454</wscn:DestinationToken> <wscn:ScanTicket> <wscn:JobDescription> <wscn:JobName>GetImage from ScanAvailableEvent</wscn:JobName> <wscn:JobOriginatingUserName> MFenelon</wscn:JobOriginatingUserName> <wscn:JobInformation>Scanning from platen..</wscn:JobInformation> </wscn:JobDescription>

40 CreateScanJob Request Example (Cont.)
<wscn:DocumentParameters> <wscn:Format>exif</wscn:Format> <wscn:ImagesToTransfer>1</wscn:ImagesToTransfer> <wscn:InputSource>Platen</wscn:InputSource> <wscn:InputSize> <wscn:InputMediaSize> <wscn:Width>1000</wscn:Width> <wscn:Height>1000</wscn:Height> </wscn:InputMediaSize> </wscn:InputSize> <wscn:Rotation>0</wscn:Rotation> <wscn:MediaSides> <wscn:MediaFront> <wscn:ColorProcessing>RGB24</wscn:ColorProcessing> <wscn:Resolution> <wscn:Width>200</wscn:Width> </wscn:Resolution> </wscn:MediaFront> </wscn:MediaSides> </wscn:DocumentParameters> </wscn:ScanTicket> </wscn:CreateScanJobRequest> </soap:Body> </soap:Envelope>

41 CreateScanJob Response Example
<soap:Envelope xmlns:soap=" xmlns:wsa=" xmlns:wsdisco=" xmlns:wsdp=" xmlns:wscn=" <soap:Header> <wsa:Action> </wsa:Action> --- Headers removed for Brevity --- </soap:Header> <soap:Body> <wscn:CreateScanJobResponse> <wscn:JobId>1</wscn:JobId> <wscn:JobToken>b5838c21-63a1-4e99-a724-b459218cae7f</wscn:JobToken> <wscn:ImageInformaiton> . </wscn:ImageInformation> <wscn:DocumentFinalParameters> </wscn:DocumentFinalParameters> </wscn:CreateScanJobResponse> </soap:Body> </soap:Envelope>

42 RetrieveImage Request Example
<soap:Envelope xmlns:soap=" xmlns:wsa=" xmlns:wsdp=" xmlns:wscn=" <soap:Header> <wsa:Action> </wsa:Action> <wsdp:ServiceId>uri:scn</wsdp:ServiceId> --- Headers removed for Brevity --- </soap:Header> <soap:Body> <wscn:RetrieveImageRequest> <wscn:JobId>1</wscn:JobId> <wscn:JobToken>b5838c21-63a1-4e99-a724-b459218cae7f</wscn:JobToken> <wscn:DocumentDescription> <wscn:DocumentName>ScannedImage001.JPG</wscn:DocumentName> </wscn:DocumentDescription> </wscn:RetrieveImageRequest> </soap:Body> </soap:Envelope>

43 RetrieveImage Response Example
Content-Type: multipart/related; boundary=4aa7d814-adc1-47a2-8e1c-07585b9892a4; type="application/xop+xml"; start-info=application/soap+xml; charset="utf-8” mime-version: 1.0 --4aa7d814-adc1-47a2-8e1c-07585b9892a4 content-type: application/xop+xml; type="application/soap+xml"; charset="utf-8" content-transfer-encoding: binary content-id: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap=" xmlns:wsa=" xmlns:wscn=" <soap:Header> <wsa:Action> </wsa:Action> </soap:Header> <soap:Body> <wscn:RetrieveImageResponse>

44 RetrieveImage Response Example (Cont.)
<wscn:ScanData> <XOP:Include xmlns:XOP=" </wscn:ScanData> </wscn:RetrieveImageResponse> </soap:Body> </soap:Envelope> --4aa7d814-adc1-47a2-8e1c-07585b9892a4 content-type: application/dib content-transfer-encoding: binary content-id: ....Binary Image data for Scan..... --4aa7d814-adc1-47a2-8e1c-07585b9892a4--


Download ppt "Web Services for Devices Install: Printers & Scanners"

Similar presentations


Ads by Google