Share via


Soapsuds 工具 (Soapsuds.exe)

Soapsuds 工具可以協助您編譯使用遠端處理技術與 XML Web Service 通訊的用戶端應用程式。Soapsuds.exe 可執行下列功能:

  • 建立描述 Common Language Runtime 組件中所公開之服務的 XML 結構描述。

  • 建立執行階段組件,以存取 XML 結構描述所描述的服務。結構描述定義可以是本機檔案,也可以動態地從網際網路下載。

soapsuds {-url:schemaUrl | -types:type1,assemblyname[,serviceEndpoint]
[;type2,assemblyname][...]] | -is:schemafile | -ia:assemblyfile} [options]
選項 說明

-domain: domain

-d: domain

指定在連接至要求網域名稱驗證 (Authentication) 的伺服器時,所要使用的網域名稱。

-generatecode

-gc

產生程式碼。這個選項相當於使用 -od:.,這裡附加的句號是指示程式碼應該置於目前的目錄中。

-httpproxyname: name

-hpn: name

指定在透過 HTTP Proxy 伺服器連接至某個伺服器時,所要使用的 HTTP Proxy 名稱。

-httpproxyport: number

-hpp: number

指定在透過 HTTP Proxy 伺服器連接至某個伺服器時,所要使用的 HTTP Proxy 通訊埠編號。

-inputassemblyfile: assemblyfile

-ia: assemblyfile

指定輸入組件檔。這個工具會從組件匯入所有型別。當您指定輸入組件時,請勿包含 .exe 或 .dll 副檔名。

-inputdirectory: directory

-id: directory

指定輸入動態連結程式庫 (DLL) 檔案的目錄位置。

-inputschemafile: schemafile

-is: schemafile

指定輸入 XML 結構描述檔。

-nowrappedproxy

-nowp

不要建立包裝的 Proxy。如果您不指定這個選項,這個工具會根據預設建立包裝的 Proxy。

-outputassemblyfile: assemblyfile

-oa: assemblyfile

將輸出儲存到指定的組件檔。Soapsuds.exe 在產生組件時必定會產生原始程式碼。

-outputdirectory: outputdirectory

-od: outputdirectory

將輸出儲存到指定的輸出目錄。

-outputschemafile: schemafile

-os: schemafile

將輸出儲存到指定的 XML 結構描述檔。

-password: password

-p: password

指定在連接至要求驗證的伺服器時,所要使用的密碼。

-proxynamespace: namespace

-pn

指定在所產生之 Proxy 中程式碼的命名空間。只對 interop 命名空間使用這個選項。

-sdl

產生服務描述語言 (Service Description Language,SDL) 結構描述 (Schema)。如果您不指定這個選項,工具將會產生 Web 服務描述語言 (WSDL) 結構描述。如需 SDL 的詳細資訊,請參閱 Web 服務描述

-serviceendpoint: URL

-se: URL

指定要放置在 WSDL 檔案中之服務結束點的 URL 或 URL 路徑。

-strongnamefile: filename

-sn: filename

簽名要以 filename 中找到的金鑰組 (Key Pairs) 所產生的組件。您可以使用強式名稱工具 (Sn.exe) 產生這個檔案。

-types: type1,assemblyname[,serviceEndpoint] [;type2,assemblyname[,serviceEndpoint]] [...]

指定輸入型別清單。

-urltoschema:schemaURL

-url:schemaURL

指定要從它擷取 XML 結構描述的 URL。

-username: username

-u: username

指定在連接至要求驗證的伺服器時,所要使用的使用者名稱。

-wrappedproxy

-wp

建立包裝的 Proxy。此為預設值。

-wsdl

產生 WSDL 結構描述。此為預設值。如需詳細資訊,請參閱 Web 服務描述

備註

請依下列步驟從您的用戶端應用程式存取 XML Web Service:

  1. 下載 XML Web Service 的 XML 結構描述 (這個工具的 -urltoschema 選項可以讓您以它的 URL 直接參考這個結構描述)。在發行 XML Web Service 時,XML Web Service 會自動產生這些結構描述檔案。

  2. 使用 Soapsuds.exe 將 XML 結構描述轉換為執行階段組件。這個工具在產生組件時必定會產生原始程式碼。

  3. 當您編譯應用程式時,在您的用戶端應用程式中參考這個組件。您也必須設定遠端處理,讓您的應用程式認識這些組件中的型別是 XML Web Service 的 Proxy。如需詳細資訊,請參閱 .NET 遠端處理概觀

範例

以下命令會從 URL 下載結構描述,並將它儲存到 XML 檔案。

soapsuds -url:https://localhost/Service/MyService.soap?wsdl 
-os:MyService.xml

以下命令會從 URL 下載結構描述,並且產生程式碼。

soapsuds -url:https://localhost/Service/MyService.soap?wsdl -gc

以下命令會從 URL 下載結構描述、將它儲存到檔案,並且產生程式碼。

soapsuds -url:https://localhost/Service/MyService.soap?wsdl 
-os:StockQuote.xml -gc

以下命令會從 URL 下載結構描述、產生程式碼、進行編譯,並且產生組件。

soapsuds -url:https://localhost/Service/MyService.soap?wsdl 
-oa:StockQuote.dll

以下命令會將型別轉換為結構描述,並將它儲存到檔案。

soapsuds -types:MyClass.MyMethod,Service -os:StockQuote.xml

以下命令會將型別轉換為結構描述,並且產生程式碼。

soapsuds -types:MyClass.MyMethod,Service -gc

以下命令會將型別轉換為結構描述、儲存到檔案,並且產生程式碼。

soapsuds -types:MyClass.MyMethod,Service -os:MyService.xml -gc 

請參閱

參考

.NET Framework 工具
強式名稱工具 (Sn.exe)
Web 服務描述語言工具 (Wsdl.exe)
Web 服務探索工具 (Disco.exe)
SDK 命令提示字元

概念

XML Web Service 概觀

其他資源

.NET Framework 遠端處理概觀