Windows Web 服务示例

以下示例演示如何使用 Windows Web Services API。

服务模型示例

计算器服务:客户端:HttpCalculatorClientExample,服务器:HttpCalculatorServiceExample

具有 SSL 传输安全性的计算器服务:客户端:HttpCalculatorWithSslClientExample,服务器:HttpCalculatorWithSslServiceExample

通过 SSL 混合模式安全性使用用户名的计算器服务:客户端:HttpCalculatorWithUsernameOverSslClientExample,服务器:HttpCalculatorWithUserNameOverSslServiceExample

通过 SSL 混合模式安全性使用 Kerberos 的计算器服务:客户端:HttpCalculatorWithKerberosOverSslClientExample,服务器:HttpCalculatorWithKerberosOverSslServiceExample

采购订单服务:客户端:HttpPurchaseOrderClientExample,服务器:HttpPurchaseOrderServiceExample

使用 SSL 传输安全性的采购订单服务:客户端:HttpPurchaseOrderWithSslClientExample,服务器:HttpPurchaseOrderWithSslServiceExample

通过 SSL 混合模式安全性使用用户名的采购订单服务:客户端:HttpPurchaseOrderWithUsernameOverSslClientExample,服务器:HttpPurchaseOrderWithUserNameOverSslServiceExample

通过 SSL 混合模式安全性使用 Kerberos 的采购订单服务:客户端:HttpPurchaseOrderWithKerberosOverSslClientExample,服务器:HttpPurchaseOrderWithKerberosOverSslServiceExample

UnTyped 采购订单服务:服务器:UnTypedServiceExample。 客户端:UnTypedClientExample

会话计算器:服务器:SessionfullCalculatorServiceExample。 客户端:SessionfullCalculatorClientExample

使用自定义通道和侦听器实现的计算器:服务器:HttpCalculatorWithLayeredChannelServiceExample。 客户端:HttpCalculatorWithLayeredChannelClientExample

使用编码通道的计算器:服务器:HttpCalculatorWithEncodedChannelServiceExample。 客户端:HttpCalculatorWithEncodedChannelClientExample

处理原始(非 SOAP)HTTP 请求的服务:客户端:HttpRawClientExample。 服务器:HttpRawServiceExample

服务作中止通知:服务器:BlockingServiceExample。 客户端:ServiceCancellationExample

调用取消:服务器:SessionfullCalculatorServiceExample。 客户端:CallAbandonExample

手动创建策略说明并将其用于创建服务代理:PolicyTemplateExample

TCP 通道层示例

使用单向模式发送消息的 TCP 示例:客户端:OneWayTcpClientExample,服务器:OneWayTcpServerExample

使用请求-回复模式发送消息的 TCP 示例:客户端:RequestReplyTcpClientExample,服务器:RequestReplyTcpServerExample

流式处理 TCP 示例:客户端:StreamingTcpClientExample,服务器:StreamingTcpServerExample

异步流式处理 TCP 示例:客户端:AsyncStreamingTcpClientExample,服务器:AsyncStreamingTcpServerExample

HTTP 通道层示例

HTTP 示例:客户端:HttpClientExample,服务器:HttpServerExample

使用流式处理 API 的 HTTP 示例:客户端:StreamingHttpClientExample,服务器:StreamingHttpServerExample

UDP 通道层示例

使用单向模式发送消息的 UDP 示例:客户端:OneWayUdpClientExample,服务器:OneWayUdpServerExample

使用多播请求响应模式发送消息的 UDP 示例:客户端:MulticastUdpClientExample,服务器:MulticastUdpServerExample 以下示例相同,但使用 IPv6 寻址:客户端:MulticastUdpClientExample6,服务器:MulticastUdpServerExample6

命名管道通道层示例

使用请求回复模式发送消息的命名管道示例:客户端:RequestReplyNamedPipesClientExample,服务器:RequestReplyNamedPipesServerExample

名为管道的流式处理示例:客户端:StreamingNamedPipesClientExample,服务器:StreamingNamedPipesServerExample

消息示例

使用自定义消息标头的示例:CustomHeaderExample

对消息进行编码和解码的示例:MessageEncodingExample

转发消息的示例:ForwardMessageExample

XML 示例

使用 XML 缓冲区 ReadWriteXmlExample 写入和读取 xml 的示例

使用 MTOM、WsWriteBytes、WsPushBytes 和 WsPullBytes ReadWriteBytesXmlExample 编写和读取二进制数据的示例

NavigateXmlExample 导航 XML 缓冲区的示例

按节点 ReadXmlExample 读取 XML 文档节点的示例

查找和显示 READAttributeExample XML 属性的示例

ReadWriteArrayExample 写入和读取元素数组的示例

将元素插入 XML 缓冲区的示例,InsertElementExample

显示使用一些 XML 缓冲区帮助程序函数的示例,XmlBufferExample

使用 wsutil 生成的帮助程序函数编写和读取派生类型的示例 DerivedTypeExample

异步模型示例

演示异步函数模型的一个示例。 AsyncModelExample

安全通道层示例

通过 TCP 的 Windows 传输安全性:客户端:RequestReplyTcpClientWithWindowsTransportSecurityExample,服务器:RequestReplyTcpServerWithWindowsTransportSecurityExample

通过命名管道的 Windows 传输安全性:客户端:RequestReplyNamedPipesClientWithWindowsTransportSecurityExample,服务器:RequestReplyNamedPipesServerWithWindowsTransportSecurityExample

SSL 传输安全性:客户端:HttpClientWithSslExample,服务器:HttpServerWithSslExample

基于 SSL 混合模式安全性的用户名:客户端:HttpClientWithUsernameOverSslExample,服务器:HttpServerWithUsernameOverSslExample

SSL 混合模式安全性用户名:客户端:HttpClientWithKerberosOverSslExample,服务器:HttpServerWithKerberosOverSslExample

元数据示例

以下示例演示如何处理 WSDL 和策略文档,目的是提取终结点支持哪些协议的信息。

基于 SSL 混合模式安全性的用户名:MetadataImportWithUsernameOverSslExample。 通过 SSL 混合模式安全性颁发令牌:MetadataImportWithIssuedTokenOverSslExample。 基于 SSL 混合模式安全性的 X509 证书:MetadataImportWithX509OverSslExample

WS-Metadata Exchange 示例

以下示例演示如何在 WS_SERVICE_HOST上启用 WS-MetadataExchange。

启用了 WS-MetadataExchange 的 TCP 服务:MetadataExchangeSample。 调用启用了 WS-MetadataExchange 的 TCP 服务的 WCF 服务名字对象客户端:ServiceMonikerSample

自定义标头和服务模型

以下示例演示如何分别对 WS_SERVICE_PROXYWS_SERVICE_HOST 使用自定义标头。

客户端:HttpCustomHeaderPurchaseOrderClientExample,服务器:HttpCustomHeaderPurchaseOrderServiceExample

文件复制示例

演示如何实现文件复制服务的综合示例:工具:FileRepToolExample,服务:FileRepServiceExample

WCF 公共服务互作

Windows Web 服务客户端与 WCF 服务客户端通信:WcfPublicServiceSample

自定义 HTTP 代理

Windows Web 服务客户端使用自定义代理客户端与 ASMX TerraService 服务通信:AsmxTerraServiceSampleWithCustomProxy