Share via


WSDAPI for .NET

3/21/2011

The Web Services on Devices for .NET package provides a managed code API for a network stack implementing the Device Profile for Web Services (DPWS) specification. The web service architecture includes a suite of specifications that define rich functions that you can use to meet varied service requirements. To promote interoperability between resource-constrained web service implementations and interoperability with more flexible client implementations, the DPWS profile identifies a core set of web service specifications in the following areas:

  • Sending messages to and from a web service
  • Dynamically discovering a web service
  • Describing a service
  • Subscribing to, and receiving events from a web service

In each of these areas of scope, the DPWS specification defines the minimal implementation requirements for compliant web service implementations.

The WSDAPI stack, contained in the core Windows Operating System also implements the DPWS specification. It ships with Windows Vista, Windows 7, Windows Server, Windows Embedded CE 6.0, and Windows Embedded Standard 7. WSDAPI is a C/C++ implementation with a native code API. Based on the Web Services on Devices Basic Interoperability Test (WSDBIT), both stacks are compatible. Services implemented targeting WSDAPI can communicate with clients implemented targeting WSDAPI for .NET and vice versa.

For using the stack, a developer must first define a service in a WSDL file. In the WSDL file, or contract, the types that the web service uses to transfer data are defined using XML schema. Then messages are defined using these types. The portType defines operations that use these messages and define a URL. The URL is used to send message requests or to subscribe to events.

The DpwsCodeGen.exe tool from the Embedded SDK is used to create code stubs. The generated C# code targets the API of WSDAPI for .NET.

As a last step the developer has to implement the functionality in the service and the client. Since these steps happen on the development machine and not on the device, the WSDAPI .NET library is not present in the Global Assembly Cache of the computer. In order to compile the code, the developer must add a reference to the Microsoft.Web.Services.DPWS.metadata.dll to the project. This metadata DLL defines the public types of the stack without implementing the functionality. The compiled binaries must be deployed to target devices that have WSDAPI for .NET in order to run. For more information, see Use WSDAPI for .NET.

As soon as the assemblies are started on the device, the service becomes available and the client can connect to it.

Because the developer defines the actual functionality of the web service, a wide variety of usage scenarios are possible. Some examples are:

Stock Value Notification: A client subscribes to events notifying the user about stock value changes.

File Service: A client sends a request message to a service. The request message contains an element of the schema type xs:string. The string represents the name of the requested file. The service responds with a message containing an element of type xs:base64Binary containing the requested file.

Factory Floor Monitoring: The status of devices and other statistics can be obtained by requesting messages from devices. In the event of a failure an event is fired to alarm the factory floor monitor.

There is a sample Visual C# project demonstrating how to use the Web Services on Devices for .NET API. The sample project is located in the Samples\DPWS\WSDBIT folder in the Standard 7 installation folder.

Note

To build the project, you need the DpwsCodeGen.exe command line application located in the EmbeddedSDK\bin folder. For more information, see the README.TXT file for the sample project.

  • WSDAPI for .NET
    Provides information about the Web Services on Devices for .NET package.

See Also

Other Resources

Embedded Enabling Features Technical Reference