views:

65

answers:

1

I am creating a COM Visible C# object to proxy calls to a webservice for VB6 application. I have a method that returns an array of objects.

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

When I call this method via VB6, like so:

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

report = proxy.DocActionReportByDateRange(startDate, reportEndDate)

It successfully executes (I can see that via logging on the web service) but no data is returned to the object in VB6 (LBound(report) == 0, UBound(report) == -1).

I have tried a couple of different approaches (changing the method to a void method and passing the collection in as a ref parameter) but no joy so far.

What do I need to do to return an array of objects (list, collection, whatever) to a VB6 consumer?

A: 

When calling a WebService all results must by serialized in order to travel through HTTP.

I recommend you to return JSON or XML to make the WebService more interoperable with other platforms.

Eduardo Molteni
The web service in question does return XML, but I am not sure how your answer is relevant.
Jonathan Bates
Instead of returning a C# array/list/collection, you can return a string that has an JSON array of objects in it.
Eduardo Molteni
it isn't about the transport, but the transform. The proxy is executing and receiving values, so XML and JSON are irrelevant.
Jonathan Bates

related questions