Passing arrays of structs from C# web service to raw C++?

Discussion in 'ASP .Net Web Services' started by WTH, Apr 20, 2005.

  1. WTH

    WTH Guest

    I have a C# webservice that returns an array of struct data back to a
    calling client.

    It works fine when tested via the ASMX page; however, I don't know how to
    make the call to this particular method from C++.

    If my web method is declared as:

    public MyStruct[] GetData()

    and returns back a web service allocated array of structs, how do I call
    this from C++?

    Intellisense tells me that the signature (to C++) is:

    GetData( MyService::MyStruct** GetDataResult, int* GetDataResult_nSizeIs )

    How am I supposed to be declaring the C++ local variable I want the results
    returned in?

    Am I supposed to pre-allocate an array of structs to receive the data?
    Am I supposed to supply an array of struct pointers and then I'm responsible
    for releasing them?

    I am having a hard time finding documentation on this...

    Thanks,
    WTH
     
    WTH, Apr 20, 2005
    #1
    1. Advertising

  2. WTH

    WTH Guest

    This is weird.

    The auto-generated SOAP code in my C++ ATL project acts like it expects a
    pre-allocated array and then proceeds to act like it does not...

    I can get the values if I just declare

    MyService::MyStruct* l_pStruct;

    and then iterate it via:

    l_pStruct++;

    Is that how I'm supposed to be going through these values?
    Seems like a great way to leak memory.

    WTH
     
    WTH, Apr 20, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patricia  Van Hise

    structs with fields that are structs

    Patricia Van Hise, Apr 5, 2004, in forum: C Programming
    Replies:
    5
    Views:
    652
    Al Bowers
    Apr 5, 2004
  2. Chris Hauxwell

    const structs in other structs

    Chris Hauxwell, Apr 23, 2004, in forum: C Programming
    Replies:
    6
    Views:
    566
    Chris Hauxwell
    Apr 27, 2004
  3. Paminu
    Replies:
    5
    Views:
    651
    Eric Sosman
    Oct 11, 2005
  4. S.
    Replies:
    7
    Views:
    305
    David Thompson
    May 12, 2008
  5. Stacy Meir

    passing structs (setializable) object in web service

    Stacy Meir, Jan 1, 2005, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    218
    Dino Chiesa [Microsoft]
    Jan 3, 2005
Loading...

Share This Page