270 likes | 607 Views
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
E N D
Web Services On Devices In Windows Vista Dave RothProgram ManagerWindows Device Experience GroupMicrosoft 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 • WSD on Windows Vista • WSDAPI Architecture • Client code • Generating WSDAPI Code
Windows® Rally™ Program Access to Technologies Simple Unified License Technical Guidance
Windows® Rally™ Devices More secure and provide rich digital experiences Effortless to configure and maintain Reliable and simple to manage
Windows Rally Experiences Windows Rally Technologies Applications Management Interfaces Plug and Play Extensions Device Specific Drivers LLTD: Quest Extensions Quality of Service Network Map LLTD: Topology Map Wireless Setup Windows Connect Now FunctionDiscovery Discovery AV Devices UPnP NetworkedDevices Device Profile for Web Services IP Network (IPv4, IPv6) Ethernet/Wireless Windows Rally Experiences Windows Rally Technologies
Web Services On DevicesDevices 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 WS-Addressing WS-Eventing WS-MetadataTransfer HTTP/1.1 WSDL 1.1 SOAP 1.2 WS-Discovery
Web Services On DevicesWindows Vista support • Windows Vista WSD support • Printing • Scanning • Projectors • Computers • WSD API Supports DPWS • Function Discovery discovers WSD devices • PnP-X detects WSD device presence
Web Services On DevicesDiscovery • 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
Client Device Service Web Services on DevicesDiscovery Probe Resolve MetadataExchange MetadataExchange Resolve: Got an Endpoint? Probe: Printer Hello! Bye! Hello! Hello! ProbeMatch: Hey, I’m a printer! ResolveMatch:Sure do! Hello!
Web Services On DevicesDiscovery Probe Request: Looking for printers • <?xml version="1.0" encoding="utf-8" ?><soap:Envelope xmlns:soap=“http://www.w3.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:MessageID>urn:uuid:95854ad7-d7ef-4769-bcbb-0648a5fa39d6</wsa:MessageID> • </soap:Header> • <soap:Body> • <wsd:Probe> • <wsd:Types> wsdp:Device wprt:PrintDeviceType</wsd:Types> • </wsd:Probe> • </soap:Body> • </soap:Envelope>
Web Services On DevicesDescription Metadata Exchange: Response to get request <soap:Envelope xmlns:soap="http://www.w3.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> <wsx:MetadataSection dialect="http://schemas.xmlsoap.org/ws/2006/02/devprof/ThisModel"> <wsdp:ThisModel> <wsdp:Manufacturer> ACME Manufacturing </wsdp:Manufacturer> <wsdp:ModelName xml:lang="en-GB">ColourBeam 9</wsdp:ModelName> <wsdp:ModelName xml:lang="en-US">ColorBeam 9</wsdp:ModelName> </wsdp:ThisModel> </wsx:MetadataSection> <wsx:MetadataSectionDialect="http://schemas.xmlsoap.org/ws/2006/02/devprof/ThisDevice"> <wsdp:ThisDevice> <wsdp:FriendlyName xml:lang="en-GB"> ACME ColourBeam Printer</wsdp:FriendlyName> <wsdp:FriendlyName xml:lang="en-US"> ACME ColorBeam Printer</wsdp:FriendlyName> </wsdp:ThisDevice> </wsx:MetadataSection> <!-- Other Metadata Sections omitted for brevity. --> </wsx:Metadata> </soap:Body> </soap:Envelope>
Web Services On DevicesControl 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 ScanningAnd Printing Shang-Lin ChuangProgram ManagerDigital Documents Group
WSD On Windows VistaWSDAPI • “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, PnP-X
WSD On Windows VistaDevice 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 • PnP-X manages “associated” devices • Detect networked device presence • Load drivers for networked devices
Provided by: Microsoft ISV/IHV Code Gen WSDAPI Architecture Client Application Hosted Device Client API GeneratedCode Host API Session Message Queuing HTTP Transport UDP Transport Listener AddressResolver
WSD On Windows VistaWSDAPI 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 VistaWSDAPI proxies • Device proxy • Obtained via FD Function Instance (FI) • Used to obtain service proxy • Service proxy • Service proxy is the control channel • Used to initialize COM based object • “Activation Layer” for class ID
WSD On Windows VistaWSDAPI client code • Query Function Discovery for FI • Activate Service from FI • Interact with service via proxy void QueryFD() { hr = spDiscovery->CreateInstanceCollectionQuery( FCTN_CATEGORY_WSDISCOVERY, NULL, TRUE, spNotify, &spFunQuery ); if ( SUCCEEDED( hr )) hr = spFunQuery->Execute( &spFunInsts ); } HRESULT OnUpdate( QueryUpdateAction eAction, IUnknown *pIUnknownForQuery, IFunctionInstance *pInstance) { IMyIF* pServiceProxy = NULL; if( NULL == pInstance) return( E_INVALIDARG ); pInstance->QueryService( pInstance, __uuidof(IMyIF), &pServiceProxy ); PlayMusic( pServiceProxy ); } Void ActivationLayer( IFunctionInstance *pIFuncInst, REFIID riid, void **ppObject) { // Declaration/Initialization code left out for brevity... if ( NULL == pIFuncInst || __uuidof(IMyIf) != riid ) return( E_INVALIDARG ); hr = GetDeviceIdentity( pIFuncInst, &identity ); if ( S_OK == hr ) hr = WSDXMLCreateContext( &spWSDXMLContext ); if ( S_OK == hr ) hr = MyDeviceRegisterNamespaces( spWSDXMLContext ); if ( S_OK == hr ) hr = MyDeviceRegisterTypes( spWSDXMLContext ); if ( S_OK == hr ) hr = WSDCreateDeviceProxy( remoteUuid, sLocalAddress, spWSDXMLContext, &spWSDDeviceProxy ); if ( S_OK == hr ) hr = spWSDDeviceProxy->GetServiceProxyById( serviceId, &spWSDServiceProxy ); // Create COM object to host the WSD Proxy... if ( S_OK == hr ) pMyObjectProxy = new CMyObjectProxy(); if ( NULL == pMyObjectProxy ) hr = E_OUTOFMEMORY; if ( S_OK == hr ) hr = pMyObjectProxy->Init( spWSDServiceProxy ); if ( S_OK == hr ) hr = pMyObjectProxy->QueryInterface( __uuidof(IMyIf), ppObject ); if ( S_OK != hr && NULL != pMyObjectProxy ) pMyObjectProxy->Release(); } void PlayMusic( CMyObjectProxy *pServiceProxy ) { IWSDOutboundAttachment* pAudioStream = NULL; WCHAR* szTitle = L”My Audio Track”; CreateStream( &pAudioStream, L”c://song.mp3” ); pServiceProxy->MyIfDisplayString( L“Hello World”); pServiceProxy->MyIfPlaySong( szTitle, pAudioStream ); pAudioStream->Release(); }
WSDL IDL Code generation Compileand link Application .cpp WSD On Windows VistaWSDAPI code generation process • Takes in WSDL and XML Schema Run Code Generation tool Generate IDL and proxy/stub code Compile with App code Produce executable
Call To Action • Implement WSD support on devices • Implement PnP-X compliance • Write FD activation code • Use WSDAPI for WSD drivers and apps • Use FD and PnP-X to discover devices and load drivers • Check out the Rally web site • Read whitepapers • Toolkit available end of 2006
Related Sessions • CON106Web Services on Devices: Current and Future Directions • CON254 Plug and Play for Network Connected Devices • CON275Web Services on Devices Hands-On Lab • PRI113Windows Image Acquisition Enhancementsin 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/WebSerDev.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, 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.