我过去在 VB.net 中开发过,但我根本不知道如何正确调用此函数以及如何获取响应,以便将其显示在网页响应中。
我将示例 c# 代码翻译成 VB。这是我希望用来发出请求然后在我的页面中显示响应的 aspx 页面背后的代码:
Imports OffAmazonPaymentsService
Imports OffAmazonPaymentsService.Model
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Write(GetOrderReferenceDetails(???service???, "asdfsadf", "asdfsadf", "asdfasdf"))
End Sub
Private Shared Function GetOrderReferenceDetails(service As IOffAmazonPaymentsService, sellerId As String, amazonOrderReferenceId As String, addressConsentToken As String) As GetOrderReferenceDetailsResponse
' Required parameters
Dim request As New GetOrderReferenceDetailsRequest()
request.SellerId = sellerId
request.AmazonOrderReferenceId = amazonOrderReferenceId
' Optional parameters
request.AddressConsentToken = addressConsentToken
Return service.GetOrderReferenceDetails(request)
End Function
End Class
我不知道如何调用该函数的第一个(服务)参数,然后显示响应的内容。
如果我的问题不够清楚,请告诉我。这是他们以升c格式给出的示例....
using OffAmazonPaymentsService;
using OffAmazonPaymentsService.Model;
public class GetOrderReferenceDetailsSample
{
/**
* Sample GetOrderReferenceDetails method that takes generic inputs, constructs a request object,
* and make a call to the service.
*/
private static GetOrderReferenceDetailsResponse GetOrderReferenceDetails(
IOffAmazonPaymentsService service,
string sellerId,
string amazonOrderReferenceId,
string addressConsentToken)
{
// Required parameters
GetOrderReferenceDetailsRequest request = new GetOrderReferenceDetailsRequest();
request.SellerId = sellerId;
request.AmazonOrderReferenceId = amazonOrderReferenceId;
// Optional parameters
request.AddressConsentToken = addressConsentToken;
return service.GetOrderReferenceDetails(request);
}
}