我試圖連接到網關服務:連接到網關服務
的服務說,這時候我「添加Web引用」它說的服務:
HTML文檔不包含Web服務發現信息。
網關服務顯示了這個:
您已經創建了一個服務。
要測試此服務,您需要創建一個客戶端並使用它來調用該服務,以便 。
svcutil.exe的http://xxxxxxxxxxxxxxx.com/API/Gateway.svc?wsdl
這將生成一個配置文件,包含 的代碼文件:您可以使用svcutil.exe的工具從以下語法 命令行做到這一點客戶類。將這兩個文件添加到您的客戶端應用程序,並使用生成的客戶端類來調用服務。例如:
C#
類測試{ 靜態無效的主要() { GatewayClient客戶=新GatewayClient();共享子主() 昏暗客戶端作爲GatewayClient =新GatewayClient
// Use the 'client' variable to call operations on the service. // Always close the client. client.Close(); } }
的Visual Basic
類檢驗 () '使用 '客戶' 變量來調用服務操作。
' Always close the client. client.Close() End Sub End Class
於是,我嘗試連接到這個代替:
http://xxxxxxxxxxxxxxx.com/API/Gateway.svc?wsdl
這給了我下面的列表:
方法AddABAccount()CloseBatch()CopyVaultAccount() ProcessAccount()ProcessCustomer()ProcessCustomerAndAccount() 進程交易()ProcessVaultTransaction()UpdateABAccount( )UpdateABSchedule()UpdateTransaction()
所以,我能添加它...
但是,當我嘗試連接到它的代碼,因爲他們建議:
GatewayClient Client = new GatewayClient("wsBinding");
TRANSACTION oT = new TRANSACTION();
GATEWAYRESPONSE oGr = new GATEWAYRESPONSE();
oT.AMOUNT = 1;
oT.TEST = "FALSE"; // When testing, use TRUE
oT.METHOD = "CC"; // We'll use a credit card
oT.ORDERID = GetOrderID(); // Define a unique id for each transaction
oT.CODE = "0000"; // An Auth only transaction
//Process the Transaction
oGr = Client.ProcessTransaction(oT);
//Close the Client
Client.Close();
if (oGr.TRANSACTIONRESPONSE.RESPONSE_CODE == "1")
{
//Handle approved transaction
}
else if (oGr.TRANSACTIONRESPONSE.RESPONSE_CODE == "2")
{
//Handle declined transaction
}
else
{
//Handle transaction error
}
我無法訪問GatewayClient,它說:
無法解析符號「GatewayClient」
我在哪裏可以找到GatewayClient!?
您在編譯時得到_Cannot解析symbol_錯誤,是否正確? – 2012-03-16 19:07:32
在我嘗試編譯之前,我在視覺工作室中獲得它。 – ErocM 2012-03-16 19:09:03
你創建它時給你的服務提供了什麼名字? – 2012-03-16 19:10:05