从VB.NET Web表单调用我的第一个WCF服务中的函数会引发错误。函数调用缺少WCF函数中的参数

问题描述 投票:1回答:2

我刚刚编写了我的第一个WCF服务,事情看起来非常顺利,直到我需要在VB.NET Web表单中使用该服务。服务中的Function声明是:

Public Function ProcessCCPaymentAuthorizeDotNet(InvoiceID As String, Description As String, CustomerID As String, CardNumber As String, ExpirationDate As String, _
    CVV As String, Price As String, FirstName As String, LastName As String, Address As String, State As String, Zip As String, CompanyName As String, BillingCity As String, _
    BillingState As String, BillingZip As String, Login As String, TranKey As String, MD5Hash As String, AuthorizeURL As String, ByRef ResponseReasonCode As Integer, _
    ByRef ResponseReasonText As String) As Integer Implements IService1.ProcessCCPaymentAuthorizeDotNet

我得到的错误是:

Argument not specified for parameter 'ProcessCCPaymentAuthorizeDotNetResult' of 'Public Sub ProcessCCPaymentAuthorizeDotNet(InvoiceID As String, Description As String, CustomerID As String, CardNumber As String, ExpirationDate As String, CVV As String, Price As String, FirstName As String, LastName As String, Address As String, State As String, Zip As String, CompanyName As String, BillingCity As String, BillingState As String, BillingZip As String, Login As String, TranKey As String, MD5Hash As String, AuthorizeURL As String, ByRef ResponseReasonCode As Integer, ByRef ResponseReasonCodeSpecified As Boolean, ByRef ResponseReasonText As String, ByRef ProcessCCPaymentAuthorizeDotNetResult As Integer, ByRef ProcessCCPaymentAuthorizeDotNetResultSpecified As Boolean)'

我很好奇ResponseReasonCodeSpecified,ProcessCCPaymentAuthorizeDotNetResult和ProcessCCPaymentAuthorizeDotNetResultSpecified甚至来自它们,因为它们不在供应给服务调用的参数列表中。我敢肯定这是一个菜鸟的错误。任何帮助是极大的赞赏!

vb.net web-services wcf
2个回答
1
投票

您要么不调用函数ProcessCCPaymentAuthorizeDotNet,要么ProcessCCPaymentAuthorizeDotNet函数调用具有相同名称但签名不同的其他方法。尽管如此,在堆栈的某个地方,另一个版本被调用,并且未传递预期的参数。您可以通过查看方法的签名与错误消息中提供的签名来判断它们的名称相同但方法不同。最大的问题是你的版本是一个函数,错误信息是Sub。

我推荐stepping through the code with the debugger。请记住,您始终可以包含try catch并查看异常的StackTrace属性,以帮助您确定代码失败的位置。


0
投票

我通过将<OperationContract()>更改为<OperationContract(), XmlSerializerFormat(Style:=OperationFormatStyle.Document)>来解决我的问题。

再次感谢您的回复。

麦克风

© www.soinside.com 2019 - 2024. All rights reserved.