Windows Web 服务示例

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

服务模型示例

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

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

具有基于 SSL 的用户名混合模式安全性的计算器服务:客户端: HttpCalculatorWithUsernameOverSslClientExample、服务器: HttpCalculatorWithUserNameOverSslServiceExample

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

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

具有 SSL 传输安全性的采购订单服务:客户端: HttpPurchaseOrderWithSslClientExample、服务器: HttpPurchaseOrderWithSslServiceExample

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

具有 Kerberos over SSL 混合模式安全性的采购订单服务:客户端: HttpPurchaseOrderWithKerberosOverSslClientExample,服务器: HttpPurchaseOrderWithKerberosOverSslServiceExample

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

会话计算器:服务器: SessionfullCalculatorServiceExample。 Client:SessionfullCalculatorClientExample

使用自定义通道和侦听器实现的计算器:Server:HttpCalculatorWithLayeredChannelServiceExample。 Client:HttpCalculatorWithLayeredChannelClientExample

使用编码通道的计算器:Server:HttpCalculatorWithEncodedChannelServiceExample。 Client:HttpCalculatorWithEncodedChannelClientExample

处理原始 (非 SOAP) HTTP 请求的服务:Client:HttpRawClientExample。 Server:HttpRawServiceExample

服务操作中止通知:服务器: BlockingServiceExample。 Client:ServiceCancellationExample

调用取消:服务器: SessionfullCalculatorServiceExample。 Client: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

命名管道通道层示例

使用请求-回复模式发送消息的命名管道示例:Client: RequestReplyNamedPipesClientExample、Server: RequestReplyNamedPipesServerExample

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

消息示例

使用自定义邮件标头的示例: CustomHeaderExample

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

转发消息的示例: ForwardMessageExample

XML 示例

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

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

导航 XML 缓冲区 NavigateXmlExample 的示例

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

查找并显示 XML 属性 ReadAttributeExample 的示例

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

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

演示如何使用某些 XML 缓冲区帮助程序函数 XmlBufferExample 的示例

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

异步模型示例

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

安全通道层示例

通过 TCP 的 Windows 传输安全性:客户端: RequestReplyTcpClientWithWindowsTransportSecurityExample、Server: RequestReplyTcpServerWithWindowsTransportSecurityExample

通过命名管道的 Windows 传输安全性:客户端: RequestReplyNamedPipesClientWithWindowsTransportSecurityExample、Server: 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。 调用 TCP 服务的 WCF 服务名字对象客户端,启用了 WS-MetadataExchange: ServiceMonikerSample

自定义标头和服务模型

以下示例演示如何分别将自定义标头与 WS_SERVICE_PROXYWS_SERVICE_HOST 配合使用。

客户端: HttpCustomHeaderPurchaseOrderClientExample,服务器: HttpCustomHeaderPurchaseOrderServiceExample

文件复制示例

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

WCF 公共服务互操作

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

自定义 HTTP 代理

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