Windows Web Services Examples

The following examples show how to use Windows Web Services API.

Service Model Examples

Calculator Service: Client: HttpCalculatorClientExample, Server: HttpCalculatorServiceExample.

Calculator Service with SSL transport security: Client: HttpCalculatorWithSslClientExample, Server: HttpCalculatorWithSslServiceExample.

Calculator Service with Username over SSL mixed-mode security: Client: HttpCalculatorWithUsernameOverSslClientExample, Server: HttpCalculatorWithUserNameOverSslServiceExample.

Calculator Service with Kerberos over SSL mixed-mode security: Client: HttpCalculatorWithKerberosOverSslClientExample, Server: HttpCalculatorWithKerberosOverSslServiceExample.

Purchase Order Service: Client: HttpPurchaseOrderClientExample, Server: HttpPurchaseOrderServiceExample.

Purchase Order Service with SSL transport security: Client: HttpPurchaseOrderWithSslClientExample, Server: HttpPurchaseOrderWithSslServiceExample.

Purchase Order Service with Username over SSL mixed-mode security: Client: HttpPurchaseOrderWithUsernameOverSslClientExample, Server: HttpPurchaseOrderWithUserNameOverSslServiceExample.

Purchase Order Service with Kerberos over SSL mixed-mode security: Client: HttpPurchaseOrderWithKerberosOverSslClientExample, Server: HttpPurchaseOrderWithKerberosOverSslServiceExample.

UnTyped Purchase Order Service: Server: UnTypedServiceExample. Client: UnTypedClientExample

Sessionful Calculator: Server: SessionfullCalculatorServiceExample. Client:SessionfullCalculatorClientExample.

Calculator using a custom channel and listener implementation: Server:HttpCalculatorWithLayeredChannelServiceExample. Client:HttpCalculatorWithLayeredChannelClientExample.

Calculator using a encoded channel: Server:HttpCalculatorWithEncodedChannelServiceExample. Client:HttpCalculatorWithEncodedChannelClientExample.

Service that handles raw (non-SOAP) HTTP requests: Client:HttpRawClientExample. Server:HttpRawServiceExample.

Service Operation Abort Notification: Server: BlockingServiceExample. Client:ServiceCancellationExample.

Call Cancellation: Server: SessionfullCalculatorServiceExample. Client:CallAbandonExample.

Manually create a policy description and use it to create a service proxy: PolicyTemplateExample.

TCP Channel Layer Examples

A TCP example that sends messages using a one-way pattern: Client: OneWayTcpClientExample, Server: OneWayTcpServerExample

A TCP example that sends messages using a request-reply pattern: Client: RequestReplyTcpClientExample, Server: RequestReplyTcpServerExample

A streaming TCP example: Client: StreamingTcpClientExample, Server: StreamingTcpServerExample

An async streaming TCP example: Client: AsyncStreamingTcpClientExample, Server: AsyncStreamingTcpServerExample

HTTP Channel Layer Examples

An HTTP example: Client: HttpClientExample, Server: HttpServerExample

An HTTP example that uses the streaming APIs: Client: StreamingHttpClientExample, Server: StreamingHttpServerExample

UDP Channel Layer Examples

A UDP example that sends messages using a one-way pattern: Client: OneWayUdpClientExample, Server: OneWayUdpServerExample

A UDP example that sends messages using a multicast request response pattern: Client: MulticastUdpClientExample, Server: MulticastUdpServerExample The following is the same example, but using IPv6 addressing: Client: MulticastUdpClientExample6, Server: MulticastUdpServerExample6

Named Pipes Channel Layer Examples

A named pipes example that sends messages using a request-reply pattern: Client: RequestReplyNamedPipesClientExample, Server: RequestReplyNamedPipesServerExample

A streaming named pipes example: Client: StreamingNamedPipesClientExample, Server: StreamingNamedPipesServerExample

Message Examples

An example that uses custom message headers: CustomHeaderExample

An example that encodes and decodes a message: MessageEncodingExample

An example that forwards a message: ForwardMessageExample

XML Examples

An example that writes and reads xml using an XML buffer ReadWriteXmlExample

An example that writes and reads binary data using MTOM, WsWriteBytes, WsPushBytes, and WsPullBytes ReadWriteBytesXmlExample

An example that navigates an XML buffer NavigateXmlExample

An example that reads an XML document node by node ReadXmlExample

An example that find and displays an XML attribute ReadAttributeExample

An example that writes and reads an array of elements ReadWriteArrayExample

An example that inserts an element into an XML buffer InsertElementExample

An example that shows the use of some XML buffer helper functions XmlBufferExample

An example that writes and reads derived type using wsutil generated helper functions DerivedTypeExample

Async Model Examples

An example that illustrates the model for asynchronous functions. AsyncModelExample

Security Channel Layer Examples

Windows transport security over TCP: Client: RequestReplyTcpClientWithWindowsTransportSecurityExample, Server: RequestReplyTcpServerWithWindowsTransportSecurityExample.

Windows transport security over named pipes: Client: RequestReplyNamedPipesClientWithWindowsTransportSecurityExample, Server: RequestReplyNamedPipesServerWithWindowsTransportSecurityExample.

SSL transport security: Client: HttpClientWithSslExample, Server: HttpServerWithSslExample.

Username over SSL mixed-mode security: Client: HttpClientWithUsernameOverSslExample, Server: HttpServerWithUsernameOverSslExample.

Username over SSL mixed-mode security: Client: HttpClientWithKerberosOverSslExample, Server: HttpServerWithKerberosOverSslExample.

Metadata Example

The following examples show how to process WSDL and Policy documents with the goal of extracting information about what protocol an endpoint supports.

Username over SSL mixed-mode security: MetadataImportWithUsernameOverSslExample. Issued token over SSL mixed-mode security: MetadataImportWithIssuedTokenOverSslExample. X509 certificate over SSL mixed-mode security: MetadataImportWithX509OverSslExample.

WS-Metadata Exchange Example

The following examples show how to enable WS-MetadataExchange on WS_SERVICE_HOST.

TCP service with WS-MetadataExchange enabled: MetadataExchangeSample. WCF service moniker client which calls into the TCP service with WS-MetadataExchange enabled: ServiceMonikerSample.

Custom headers and Service model

The following examples show how to use custom headers with WS_SERVICE_PROXY and WS_SERVICE_HOST respectively.

Client: HttpCustomHeaderPurchaseOrderClientExample, Server: HttpCustomHeaderPurchaseOrderServiceExample.

File Replication Sample

A comprehensive sample that demonstrates how to implement a file replication service: Tool: FileRepToolExample, Service: FileRepServiceExample.

WCF Public Service Interoperation

A Windows Web Services client communicates with a WCF service Client: WcfPublicServiceSample.

Custom HTTP Proxy

A Windows Web Services client communicates with a ASMX TerraService service using custom proxy Client: AsmxTerraServiceSampleWithCustomProxy