共用方式為


Windows Web 服務範例

下列範例示範如何使用 Windows Web 服務 API。

服務模型範例

計算機服務:用戶端: HttpCalculatorClientExample、伺服器: HttpCalculatorServiceExample

具有 SSL 傳輸安全性的計算機服務:用戶端: HttpCalculatorWithSslClientExample、伺服器: HttpCalculatorWithSslServiceExample

透過 SSL 混合模式安全性的使用者名稱計算服務:用戶端: HttpCalculatorWithUsernameOverSslClientExample、伺服器: HttpCalculatorWithUserNameOverSslServiceExample

透過 SSL 混合模式安全性使用 Kerberos 的計算機服務:用戶端: HttpCalculatorWithKerberosOverSslClientExample、Server: HttpCalculatorWithKerberosOverSslServiceExample

採購單服務:用戶端: HttpPurchaseOrderClientExample、伺服器: HttpPurchaseOrderServiceExample

具有 SSL 傳輸安全性的採購單服務:用戶端: HttpPurchaseOrderWithSslClientExample、伺服器: HttpPurchaseOrderWithSslServiceExample

透過 SSL 混合模式安全性使用使用者名稱的採購單服務:用戶端: HttpPurchaseOrderWithUsernameOverSslClientExample、伺服器: HttpPurchaseOrderWithUserNameOverSslServiceExample

透過 SSL 混合模式安全性使用 Kerberos 的採購單服務:用戶端: HttpPurchaseOrderWithKerberosOverSslClientExample、伺服器: HttpPurchaseOrderWithKerberosOverSslServiceExample

UnTyped Purchase Order Service:Server: 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

手動建立原則描述,並用它來建立服務 Proxy: PolicyTemplateExample

TCP 通道層範例

使用單向模式傳送訊息的 TCP 範例:用戶端: OneWayTcpClientExample、伺服器: OneWayTcpServerExample

使用要求-回復模式傳送訊息的 TCP 範例:用戶端: RequestReplyTcpClientExample、Server: RequestReplyTcpServerExample

串流 TCP 範例:用戶端: StreamingTcpClientExample、伺服器: StreamingTcpServerExample

非同步串流 TCP 範例:用戶端: AsyncStreamingTcpClientExample、伺服器: AsyncStreamingTcpServerExample

HTTP 通道層範例

HTTP 範例:用戶端: HttpClientExample、伺服器: HttpServerExample

使用串流 API 的 HTTP 範例:用戶端: StreamingHttpClientExample、伺服器: StreamingHttpServerExample

UDP 通道層範例

使用單向模式傳送訊息的 UDP 範例:Client: OneWayUdpClientExample、Server: OneWayUdpServerExample

使用多播要求回應模式傳送訊息的 UDP 範例:用戶端: MulticastUdpClientExample、Server: MulticastUdpServerExample 下列範例相同,但使用 IPv6 定址:用戶端: MulticastUdpClientExample6、Server: MulticastUdpServerExample6

具名管道通道圖層範例

使用要求-回復模式傳送訊息的具名管道範例:Client: RequestReplyNamedPipesClientExample、Server: RequestReplyNamedPipesServerExample

名為 pipes 的串流範例:用戶端: 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 傳輸安全性:Client: 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。 WCF 服務 Moniker 用戶端,其會呼叫已啟用WS-MetadataExchange的 TCP 服務: ServiceMonikerSample

自訂標頭和服務模型

下列範例示範如何分別搭配 WS_SERVICE_PROXYWS_SERVICE_HOST 使用自訂標頭。

用戶端: HttpCustomHeaderPurchaseOrderClientExample,伺服器: HttpCustomHeaderPurchaseOrderServiceExample

檔案複寫範例

示範如何實作檔案複寫服務的完整範例:Tool: FileRepToolExample、Service: FileRepServiceExample

WCF 公用服務交互操作

Windows Web 服務用戶端會與 WCF 服務用戶端通訊: WcfPublicServiceSample

自訂 HTTP Proxy

Windows Web 服務用戶端會使用自訂 Proxy 用戶端與 ASMX TerraService 服務通訊: AsmxTerraServiceSampleWithCustomProxy