WSDAPI Client Application and Device Host Development

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

Applies to Windows Embedded CE 6.0 R2

You can use the Web Services on Devices API (WSDAPI) to develop client applications to find and access device hosts, and to develop device hosts and associated services that run on Windows Vista and Windows Embedded CE. Use the following APIs to create applications that are compliant with Devices Profile for Web Services (DPWS).

Major WSDAPI interfaces

The four major WSDAPI interfaces are IWSDiscoveryProvide, IWSDiscoveryPublisher, IWSDDeviceProxy, and IWSDDeviceHost. For a list of all of the WSDAPI interfaces, see Web Services on Devices Interfaces.

IWSDiscoveryProvider

IWSDiscoveryProvider enables client-side WS-Discovery implementation.

IWSDiscoveryProvider issues WS-Discovery Probe and Resolve messages, and receives Hello, Bye, ProbeMatches, and ResolveMatches messages. Use information retrieved through the IWSDiscoveryProvider interface when creating an IWSDDeviceProxy interface for description and control functionality of a specific DPWS device.

An IWSDiscoveryProvider interface is not necessary if the only desired functionality is resolving a particular DPWS device address before creating a device proxy. That functionality is built into WSDCreateDeviceProxy.

IWSDiscoveryPublisher

IWSDiscoveryPublisher enables device-side WS-Discovery implementation.

IWSDiscoveryPublisher allows an application to publish its presence using WS-Discovery with Hello and Bye messages. This interface allows an application to receive Probe and Resolve requests, and construct and send ProbeMatches and ResolveMatches responses.

IWSDiscoveryPublisher is not necessary to publish the existence of an IWSDDeviceHost object. IWSDDeviceHost manages its own WS-Discovery presence.

IWSDDeviceProxy

IWSDDeviceProxy enables client-side WS-Discovery, WS-MetadataExchange, and control functionality, including secure channel, WS-Eventing, and attachments.

The IWSDDeviceProxy interface has the following three uses:

  • Resolves a logical device address, if necessary
  • Initiates a metadata request to the device to enumerate the types and addresses of services
  • Provides a source for IWSDServiceProxy objects, which can be used to issue control messages to specific services on the device.

The IWSDDeviceProxy object is typically created and used entirely inside code generated by WsdCodeGen. For more information on WsdCodeGen, see this Microsoft Web site.

IWSDDeviceHost

IWSDDeviceHost enables device implementation that supports WS-Discovery, WS-MetadataExchange, and the hosting of service. These services may respond to control messages, and may support secure channel, WS-Eventing, and attachments.

The IWSDDeviceHost interface has the following three uses:

  • Hosts service objects
  • Announces the presence of a device host on the network using WS-Discovery
  • Dispatches network requests into the objects

WS-Discovery, WS-MetadataExchange, and management of WS-Eventing subscriptions are handled entirely within the device host object.

Hosting of services inside a device host requires creation of the host by using WSDCreateDeviceHost, registration of metadata, registration of services, and control of the state valuesStart and Stop. The IWSDDeviceHost object is typically created and used inside code generated by WsdCodeGen. For more information on WsdCodeGen, see this Microsoft Web site.

You can create devices that interoperate with Windows-based WSDAPI client applications and device hosts and services without using Microsoft’s WSDAPI solution.

In addition to developing the device functionality, you must create a Devices Profile for Web Services (DPWS) solution. Devices that use the secure channel for communication must also implement a number of security-related requirements. For information about device hosts, see this Microsoft Web site. For information about secure channel for WSDAPI communication see Configuring WSDAPI Applications to Use a Secure Channel.

WSDAPI Code Generation Tool

The WSD Code Generator, WsdCodeGen, is a command-line tool that creates C++ code from Web Service Description Language (WSDL) contracts for a service, a client, or both. The tool generates code for service-side stub, client-side proxy, and interface and type code for both. The service description that WsdCodeGen consumes is stored in WSDL and/or XSD files.

WsdCodeGen creates C++ and IDL (Interface Definition Language) files. You can use WsdCodeGen to create WSDAPI applications without worrying about how the data is collected and represented on a connection. You can code and build a client application using the client-side proxy for outgoing service calls and the service-side stub for incoming event notifications. For more information about the WSDAPI Code Generation tool, see this Microsoft Web site.

File Description

%_WINCEROOT%\public\servers\sdk\samples\wsd\WsdCodeGen.exe

WSD Code Generation Tool

WSDAPI Troubleshooting Guide

The WSDAPI Troubleshooting Guide can help you troubleshoot failures you might encounter when using WSDAPI discovery interfaces, when creating a WSDAPI device or client-side proxy, or when using operating system functions that rely on WSDAPI. The primary goal is to help troubleshoot problems that occur when a client application and device host cannot communicate with each other on the network. To read the WSDAPI Troubleshooting Guide, see this Microsoft Web site.

See Also

Concepts

WSDAPI Supported Functionality
Using WSDAPI with a Secure Channel
Configuring WSDAPI Applications to Use a Secure Channel

Other Resources

Web Services on Devices