How to: Use a Proxy Generated by Wsdl.exe

The .NET Compact Framework does not support all the code generated by the Web Services Description Language Tool (Wsdl.exe). However, applications that use Web services can use the generated proxy when you add a Web reference to a Smart Device project in Visual Studio.

There are situations when you might want to use Wsdl.exe. One case is when you have to provide the order of particle members in your proxy to conform with the order required by a Web service. The Wsdl.exe tool has an /order option that generates explicit order identifiers on particle members.

Note

To avoid the step of manually removing generated code from the proxy, you can first add a Web reference to a Smart Device project in Visual Studio, and then run Wsdl.exe /order in another directory. Finally, copy the code that preserves explicit ordering of elements from the proxy that was generated by Wsdl.exe into the proxy that was generated by adding the Web reference.

The following procedure shows which code to remove from the generated proxy so that it can be used by the .NET Compact Framework. The code to remove is listed in the order that it appears in the generated proxy.

Note

Wsdl.exe may not generate all the code described in the following procedure. The code that is generated code depends partially on the associated service.

To remove unsupported code from the generated proxy

  1. Generate the proxy with the Web Services Description Language Tool (Wsdl.exe).

  2. Remove code that defines a delegate named RetBaseTypesOperationCompleted of type SendOrPostCallback.

  3. Remove code that defines and references the RetBaseTypesCompleted event, the RetBaseTypesCompletedEventHandler delegate, and the RetBaseTypesCompletedEventArgs class.

  4. Remove code that defines and calls the RetBaseTypesAsync method.

  5. Remove code that defines and calls the OnRetBaseTypesOperationCompleted method.

  6. Remove code that defines and calls the CancelAsync method.

  7. Remove the Serializable attribute.

See Also

Concepts

Network Programming in the .NET Compact Framework

.NET Compact Framework How-to Topics