Web Services On Devices In Windows Vista Dave
Web Services On Devices In Windows Vista Dave Roth Program Manager Windows Device Experience Group Microsoft Corporation
Agenda Web Services on Devices (WSD) Devices Profile for Web Services (DPWS) Discovery Description Control and eventing Demo Windows Vista’s support for WSD on Windows Vista WSDAPI Architecture Client code Generating WSDAPI Code
® Windows Access to Technologies Rally™ Program Simple Unified License Technical Guidance
® Windows Effortless to configure and maintain Rally™ Devices Reliable and simple to manage More secure and provide rich digital experiences
Windows. Rally. Technologies Experiences Management Interfaces Function Discovery Windows Wireless Connect Setup. Now LLTD: Network Topology Map LLTD: Quality Quest of Extensions Service Applications Plug Device and. Specific Play Extensions Drivers AVUPn. P Devices IP Network (IPv 4, IPv 6) Ethernet/Wireless Windows Rally Technologies Experiences Device Networked Profile for Web Devices Services
Web Services On Devices profile for web services (DPWS) Defines how devices can use Web Services Supports resource constrained devices Ensures interoperability between devices and PCs Enables device and service discovery Supports rich eventing Endpoint provides device/host metadata Built on standards and WS specifications HTTP/1. 1 WSDL 1. 1 SOAP 1. 2 WS-Discovery WS-Addressing WS-Eventing WS-Metadata. Transfer
Web Services On Devices Windows Vista support Windows Vista WSD support Printing Scanning Projectors Computers WSD API Supports DPWS Function Discovery discovers WSD devices Pn. P-X detects WSD device presence
Web Services On Devices Discovery Uses the WS-Discovery specification Multicast announcements Multicast query requests (probe/resolve) Unicast responses Device announces presence Send out Hello and Bye messages Device responds to client requests Probe: Identify a device or service Resolve: Locate device or service endpoint Get information via metadata exchange
Web Services on Devices Device Resolve Metadata Exchange Service Discovery Resolve: Probe: Printer Got an Endpoint? Hello! Bye! Hello! Probe. Match: Resolve. Match: Hey, I’m a printer! Hello! Sure do! Probe Metadata Exchange Client
Web Services On Devices Discovery Probe Request: Looking for printers <? xml version="1. 0" encoding="utf-8" ? > <soap: Envelope xmlns: soap=“http: //www. w 3. org/2003/05/soap-envelope” xmlns: wsa=“http: //schemas. xmlsoap. org/ws/2004/08/addressing” xmlns: wsd=“http: //schemas. xmlsoap. org/ws/2005/04/discovery” xmlns: wsdp=“http: //schemas. xmlsoap. org/ws/2006/02/devprof” xmlns: wprt=“http: //schemas. microsoft. com/windows/2006/01/wpd/print”> <soap: Header> <wsa: To>urn: schemas-xmlsoap-org: ws: 2005: 04: discovery</wsa: To> <wsa: Action>http: //schemas. xmlsoap. org/ws/2005/04/discovery/Probe </wsa: Action> <wsa: Message. ID>urn: uuid: 95854 ad 7 -d 7 ef-4769 -bcbb 0648 a 5 fa 39 d 6</wsa: Message. ID> </soap: Header> <soap: Body> <wsd: Probe> <wsd: Types> wsdp: Device wprt: Print. Device. Type </wsd: Types> </wsd: Probe> </soap: Body> </soap: Envelope>
Web Services On Devices Description Metadata Exchange: Response to get request <soap: Envelope xmlns: soap="http: //www. w 3. org/2003/05/soap-envelope" xmlns: wsa=http: //schemas. xmlsoap. org/ws/2004/08/addressing" xmlns: wsx="http: //schemas. xmlsoap. org/ws/2004/09/mex" xmlns: wsdp="http: //schemas. xmlsoap. org/ws/2006/02/devprof" > <!-- Headers omitted for brevity. --> <soap: Body> <wsx: Metadata. Section dialect="http: //schemas. xmlsoap. org/ws/2006/02/devprof/This. Model"> <wsdp: This. Model> <wsdp: Manufacturer> ACME Manufacturing </wsdp: Manufacturer> <wsdp: Model. Name xml: lang="en-GB"> Colour. Beam 9 </wsdp: Model. Name> <wsdp: Model. Name xml: lang="en-US"> Color. Beam 9 </wsdp: Model. Name> </wsdp: This. Model> </wsx: Metadata. Section> <wsx: Metadata. Section. Dialect="http: //schemas. xmlsoap. org/ws/2006/02/devprof/This. Device"> <wsdp: This. Device> <wsdp: Friendly. Name xml: lang="en-GB"> ACME Colour. Beam Printer </wsdp: Friendly. Name> <wsdp: Friendly. Name xml: lang="en-US"> ACME Color. Beam Printer </wsdp: Friendly. Name> </wsdp: This. Device> </wsx: Metadata. Section> <!-- Other Metadata Sections omitted for brevity. --> </wsx: Metadata> </soap: Body> </soap: Envelope>
Web Services On Devices Control and eventing Contract defined by WSDL and XML schema Ensures common baseline for interop Uses standard WSDL/1. 1 Presents rich eventing model WSDL allows for detailed events Client subscribes to events Device pushes events to clients Supports a Secure Channel Based on SSL Provides encryption Supports host and client authentication
WSD Scanning And Printing Shang-Lin Chuang Program Manager Digital Documents Group
WSD On Windows Vista WSDAPI “Web Services on Devices API” Implements DPWS compliant SOAP stack Implements discovery networking stack Low level API Unmanaged code ‘C++’ Interfaces Discovery/Publication Client/Hosting Works with Function Discovery, Pn. P-X
WSD On Windows Vista Device discovery and description Function Discovery discovers devices Query network for devices and services Notifies application when devices go on/offline Supports Directed Discovery Provides device description metadata Enables device activation Pn. P-X manages “associated” devices Detect networked device presence Load drivers for networked devices
WSDAPI Architecture Client Application Hosted Device Provided by: Microsoft Client API ISV/IHV Generated Code Host API Session Message Queuing HTTP Transport UDP Transport Listener Address Resolver Code Gen
WSD On Windows Vista WSDAPI code generation tool Code Gen tool abstracts complexity Converts WSDL types into WSDAPI calls Complies WSDL into C++ code Proxy code – Used by clients Stub code – Used by hosts IDL – Describes interfaces Apps call into generated code
WSD On Windows Vista WSDAPI proxies Device proxy Obtained via FD Function Instance (FI) Used to obtain service proxy Service proxy is the control channel Used to initialize COM based object “Activation Layer” for class ID
WSD On Windows Vista WSDAPI client code Query Function Discovery for FI Activate Service from FI Interact with service via proxy void Void Query. FD() Activation. Layer( IFunction. Instance *p. IFunc. Inst, REFIID riid, void **pp. Object) void Play. Music( CMy. Object. Proxy *p. Service. Proxy ) { { hr sp. Discovery->Create. Instance. Collection. Query( // = Declaration/Initialization code left out for brevity. . . IWSDOutbound. Attachment* p. Audio. Stream = NULL; FCTN_CATEGORY_WSDISCOVERY, NULL, TRUE, sp. Notify, if ( NULL == p. IFunc. Inst || __uuidof(IMy. If) != riid ) return( E_INVALIDARG ); WCHAR* sz. Title = L”My Audio Track”; &sp. Fun. Query ); p. IFunc. Inst, &identity ); hr = Get. Device. Identity( if ( S_OK == hr ) hr = WSDXMLCreate. Context( &sp. WSDXMLContext ); Create. Stream( &p. Audio. Stream, L”c: //song. mp 3” ); if ( SUCCEEDED( )) = My. Device. Register. Namespaces( sp. WSDXMLContext ); S_OK == hr hr ) hr sp. Fun. Query->Execute( &sp. Fun. Insts ); ifhr ( = S_OK == hr ) hr = My. Device. Register. Types( sp. WSDXMLContext ); p. Service. Proxy->My. If. Display. String( L“Hello World”); } if ( S_OK == hr ) hr = WSDCreate. Device. Proxy( remote. Uuid, s. Local. Address, p. Service. Proxy->My. If. Play. Song( sz. Title, p. Audio. Stream ); sp. WSDXMLContext, &sp. WSDDevice. Proxy ); HRESULT On. Update( e. Action, if ( S_OK == hr Query. Update. Action ) hr = sp. WSDDevice. Proxy->Get. Service. Proxy. By. Id( service. Id, p. Audio. Stream->Release(); IUnknown *p. IUnknown. For. Query, &sp. WSDService. Proxy ); } IFunction. Instance *p. Instance) // Create COM object to host the WSD Proxy. . . { if ( S_OK == hr ) p. My. Object. Proxy = new CMy. Object. Proxy(); IMy. IF* p. Service. Proxy = NULL; ) hr = E_OUTOFMEMORY; if ( NULL == p. My. Object. Proxy E_INVALIDARG ); if( if (NULL S_OK== ==p. Instance) hr = return( p. My. Object. Proxy->Init( sp. WSDService. Proxy ); p. Instance->Query. Service( p. Instance, __uuidof(IMy. IF), &p. Service. Proxy ); pp. Object ); if ( S_OK == hr ) hr = p. My. Object. Proxy->Query. Interface( __uuidof(IMy. If), p. Service. Proxy ); p. My. Object. Proxy ) p. My. Object. Proxy->Release(); Play. Music( if ( S_OK != hr && NULL != }
WSD On Windows Vista WSDAPI code generation process Takes in WSDL and XML Schema Run Code Generation tool IDL WSDL Code generation Compile and link. cpp Generate IDL and proxy/stub code Compile with App code Produce executable
Call To Action Implement WSD support on devices Implement Pn. P-X compliance Write FD activation code Use WSDAPI for WSD drivers and apps Use FD and Pn. P-X to discover devices and load drivers Check out the Rally web site Read whitepapers Toolkit available end of 2006
Related Sessions CON 106 Web Services on Devices: Current and Future Directions CON 254 Plug and Play for Network Connected Devices CON 275 Web Services on Devices Hands-On Lab PRI 113 Windows Image Acquisition Enhancements in Windows Vista Ask the Experts Microsoft Pavilion
Additional Resources Microsoft Rally http: //www. microsoft. com/rally Devices Profile for Web Services (February 2006) http: //schemas. xmlsoap. org/ws/2006/02/devprof/ WSD Developer Story http: //msdn. microsoft. com/library/en-us/dnlong/html/Web. Ser. Dev. asp Windows’ Web Services http: //msdn. microsoft. com/webservices/default. aspx Web Services Feedback Workshops http: //msdn. microsoft. com/webservices/community/workshops/ Web Services Basics http: //msdn. microsoft. com/webservices/understanding/ webservicebasics/default. aspx
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U. S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
- Slides: 25