如何将数组/列表/对象集合从C#返回到VB6

Jon*_*tes 11 arrays vb6 com-interop

我正在创建一个COM Visible C#对象来代理对VB6应用程序的Web服务的调用.我有一个返回对象数组的方法.

public DocActionReport[] DocActionReportByDateRange(System.DateTime reportStartDate, System.DateTime reportEndDate)
    {
        object[] results = this.Invoke("DocActionReportByDateRange", new object[] {
                    reportStartDate,
                    reportEndDate});
        return ((DocActionReport[])(results[0]));
    }
Run Code Online (Sandbox Code Playgroud)

当我通过VB6调用此方法时,如下所示:

Dim proxy As New QueueMovementServiceClient.ReadQueueInfo
Dim report() As QueueMovementServiceClient.DocActionReport

report = proxy.DocActionReportByDateRange(startDate, reportEndDate)
Run Code Online (Sandbox Code Playgroud)

它成功执行(我可以看到通过登录Web服务)但没有数据返回到VB6中的对象(LBound(报告)== 0,UBound(报告)== -1).

我尝试了几种不同的方法(将方法更改为void方法并将集合作为ref参数传递)但到目前为止没有任何乐趣.

我需要做什么才能将对象数组(列表,集合等)返回给VB6使用者?

Edu*_*eni 0

调用 WebService 时,所有结果都必须序列化才能通过 HTTP 传输。

我建议您返回JSONXML,以使 WebService 与其他平台更具互操作性。