Click here to Skip to main content
15,905,420 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to pass structure or complex data in IDispatch using invoke() method . Pin
Thomas_Mathews19-Jan-09 2:08
Thomas_Mathews19-Jan-09 2:08 
AnswerRe: How to pass structure or complex data in IDispatch using invoke() method . Pin
Stuart Dootson19-Jan-09 4:09
professionalStuart Dootson19-Jan-09 4:09 
AnswerRe: How to pass structure or complex data in IDispatch using invoke() method . Pin
Radhakrishnan G.19-Jan-09 4:20
Radhakrishnan G.19-Jan-09 4:20 
GeneralRe: How to pass structure or complex data in IDispatch using invoke() method . Pin
Stuart Dootson19-Jan-09 6:50
professionalStuart Dootson19-Jan-09 6:50 
GeneralRe: How to pass structure or complex data in IDispatch using invoke() method . Pin
Thomas_Mathews19-Jan-09 19:09
Thomas_Mathews19-Jan-09 19:09 
GeneralRe: How to pass structure or complex data in IDispatch using invoke() method . Pin
Stuart Dootson19-Jan-09 19:48
professionalStuart Dootson19-Jan-09 19:48 
GeneralRe: How to pass structure or complex data in IDispatch using invoke() method . [modified] Pin
Thomas_Mathews19-Jan-09 20:19
Thomas_Mathews19-Jan-09 20:19 
GeneralRe: How to pass structure or complex data in IDispatch using invoke() method . Pin
Stuart Dootson19-Jan-09 22:07
professionalStuart Dootson19-Jan-09 22:07 
Firstly - you implied you had a C# client for your COM server, not for some web-service. This would appear to be incorrect...

Thomas_Mathews wrote:
I am writing a client in c++ to invoke that webservice using IDispatch


Yeah...don't think that's going to work - the CP article you reference doesn't use IDispatch to call web-services, and really, IDispatch isn't for calling web services.

Thomas_Mathews wrote:
This is structure we pass in c# for calling method
[System.Xml.Serialization.XmlTypeAttribute]
public class BLOB {

/// <remarks>
public string contentType;

[System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
public System.Byte[] binaryData;

public string ID;

public string URL;
}


The "[System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]" gives it away - this structure is sent to the web-service by serializing the structure contents as a chunk of XML. That implies to me that the web-service is probably using SOAP - maybe you could use something like gSOAP[^] to write your C++ client? Do you have a WSDL file that defines the web-service interface?

Thomas_Mathews wrote:
If above is complex is anyone know how to pass structure like below in IDispatch's Invoke() method. The COM Server is third party.

struct tag{
char str[100];
void *p;
char str1[300];
}


Strikes me that this is a completely separate problem from the one above - the only connection is "I have a method call that I wish to serialize between a client and a remote (to some extent) server".

Now. This third-party COM server. It must define its interface somewhere. There must be something that tells you what methods it will understand on its IDispatch interface. If you don't have an IDL file, you ought to have a type library (it's usually embedded in the server somehow). Maybe you could try generating an interface to the COM server using #import[^], specifying the COM server DLL or EXE as the thing you're importing?

Also - you cannot send a struct as a parameter to an IDispatch method. Your C# web-service client manages it by converting the struct instance to an XML string which is in a format that both the client and web-service understand to mean the same thing. That means that the web-service can convert the XML string it receives into a struct instance that contains the same data that the client sent. Now, IDispatch does not have this capability. You could layer an XML serializer on top and send an XML string to the COM server as a BSTR. Would it do what you want? Probably not. But that's the thing - you have still not given sufficient detail that we can understand your problem.
Questiondialog box displaying not responding Pin
VCProgrammer19-Jan-09 0:53
VCProgrammer19-Jan-09 0:53 
AnswerRe: dialog box displaying not responding Pin
Cedric Moonen19-Jan-09 1:09
Cedric Moonen19-Jan-09 1:09 
GeneralRe: dialog box displaying not responding Pin
Luc Pattyn19-Jan-09 1:15
sitebuilderLuc Pattyn19-Jan-09 1:15 
QuestionGet hour and minute value. Pin
Le@rner19-Jan-09 0:52
Le@rner19-Jan-09 0:52 
AnswerRe: Get hour and minute value. Pin
Cedric Moonen19-Jan-09 1:02
Cedric Moonen19-Jan-09 1:02 
AnswerRe: Get hour and minute value. Pin
CPallini19-Jan-09 4:50
mveCPallini19-Jan-09 4:50 
GeneralRe: Get hour and minute value. Pin
Le@rner19-Jan-09 17:12
Le@rner19-Jan-09 17:12 
AnswerRe: Get hour and minute value. Pin
Hamid_RT20-Jan-09 19:55
Hamid_RT20-Jan-09 19:55 
QuestionDialog's of other processes on top of another process Pin
Super Hornet18-Jan-09 23:18
Super Hornet18-Jan-09 23:18 
AnswerRe: Dialog's of other processes on top of another process - REPOST Pin
Iain Clarke, Warrior Programmer18-Jan-09 23:22
Iain Clarke, Warrior Programmer18-Jan-09 23:22 
GeneralRe: Dialog's of other processes on top of another process - REPOST Pin
Super Hornet18-Jan-09 23:47
Super Hornet18-Jan-09 23:47 
GeneralRe: Dialog's of other processes on top of another process - REPOST Pin
Stuart Dootson19-Jan-09 0:22
professionalStuart Dootson19-Jan-09 0:22 
GeneralRe: Dialog's of other processes on top of another process - REPOST Pin
sashoalm19-Jan-09 1:13
sashoalm19-Jan-09 1:13 
AnswerRe: Dialog's of other processes on top of another process Pin
Chandrasekharan P19-Jan-09 0:48
Chandrasekharan P19-Jan-09 0:48 
GeneralRe: Dialog's of other processes on top of another process Pin
Super Hornet19-Jan-09 19:25
Super Hornet19-Jan-09 19:25 
Questionvisual c++ with msaccess program example Pin
karthik12345618-Jan-09 23:00
karthik12345618-Jan-09 23:00 
AnswerRe: visual c++ with msaccess program example Pin
Chandrasekharan P18-Jan-09 23:26
Chandrasekharan P18-Jan-09 23:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.