473,769 Members | 4,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

WTH
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::MySt ruct** GetDataResult, int* GetDataResult_n SizeIs )

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
Nov 23 '05 #1
2 6067
DC
you need to look at p/invoke,
try the interop newsgroup.

The high-order bit here is not webservices, but p/invoke.

"WTH" <sp*******@Ih8i t.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
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::MySt ruct** GetDataResult, int* GetDataResult_n SizeIs )

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

Nov 23 '05 #2
WTH
DC <di****@online. microsoft.com> loquated like no one had ever loquated
before with:
you need to look at p/invoke,
try the interop newsgroup.

The high-order bit here is not webservices, but p/invoke.


Could you give me a little clarification about that before I go to the
interop ng?

I mean, I trace it into the ATL soap code and see where an ATL function
asserts that the pointer I pass in is not NULL, and then, and the end of
this same method, it calls:

*in_pMyPoint = _params.AtlCopy OfMyStructure

WTH
Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3601
by: Amr Mostafa | last post by:
Hello :) I'm trying to write a script that deals with a web service. I'm using NuSoap class. my question is : Can I pass some variables By Reference to the web service and get the result back in my variables ?? note1: I'm not the one who wrote the web service.. so I can't modify
19
1760
by: Method Man | last post by:
I understand that arrays and structs can't be passed by value into and out of functions since they can be arbitrarily big. My question is: Why are types allowed to be passed by value? Couldn't my types be arbitraily big as well?
8
4116
by: kalinga1234 | last post by:
there is a problem regarding passing array of characters to another function(without using structures,pointer etc,).can anybody help me to solve the problem.
33
3875
by: Peter Seaman | last post by:
I understand that structures are value types and arrays and classes are reference types. But what about arrays as members of structures i.e. as in C struct x { int n; int a; }
0
1312
by: SB | last post by:
I have few web service methods that take and return array of structures. I created these web methods in .NET with the default encoding (document/literal). They worked perfectly during my testing. Later I had to comply with one of the requirements from the customer and made the web service to use rpc/literal encoding and used the attribute. It compiles and builds without any trobule. But when I try to add web reference to this service, it...
10
4995
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I get an error: ---------------- An unhandled exception of type 'System.NullReferenceException' occured in
6
8967
by: =?Utf-8?B?QWxleGFuZGVyZmU=?= | last post by:
Hi, I have a C# program that uses an unmanaged dll that has a function similar to the signature below : void f(out MyStruct arr, out int num); // num = actual array length returned The array must be allocated (with known max length = 10) before the call to the dll function (the dll just fills it ,with no allocations). The definitions of Mystruct and :
8
3503
by: S. | last post by:
Hi all, Can someone please help me with this? I have the following struct: typedef struct { char *name; int age; } Student;
5
1974
by: Eric Fortin | last post by:
I have a disconnected handheld device that I want to send the results of the day to a database through a web service (on an intranet) What's the best method to do this? XML? Tab Delimited/Carriage Return String? Through a file? Other?
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.