我试图连接到网关服务:连接到网关服务
的服务说,这时候我“添加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