By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,931 Members | 1,565 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,931 IT Pros & Developers. It's quick & easy.

Asynchronous calls to a web Service

P: n/a
I have a C++ application that consumes a web service. I would like to call
the web service asynchronously so my C++ application can do other processing
in between.
My proxy file does not have any asynchronous methods in it, What do I have
to do to get my proxy file to have the asynchronous methods to call?

Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
rgarf wrote:
I have a C++ application that consumes a web service. I would like to
call
the web service asynchronously so my C++ application can do other
processing
in between.
My proxy file does not have any asynchronous methods in it, What do I
have
to do to get my proxy file to have the asynchronous methods to call?


How did you generate the proxy? What language is it in? WSDL.exe and WseWsdl2.exe both generate in C#/VB.NET and both definitely generate asyn method pairs per web method. If you generated it by hand in C++ you'll need to do a little more work to get the async methods on there as well.

-Drew
Nov 21 '05 #2

P: n/a
The proxy was generated automatically when I added the web service as a
reference to my C++ application, so it was generated in C++ by Visual Studio.
Do I have to add anything to the generated proxy to get the asynchronous
calls, I thought it should do it automatically?

"Drew Marsh" wrote:
rgarf wrote:
I have a C++ application that consumes a web service. I would like to
call
the web service asynchronously so my C++ application can do other
processing
in between.
My proxy file does not have any asynchronous methods in it, What do I
have
to do to get my proxy file to have the asynchronous methods to call?


How did you generate the proxy? What language is it in? WSDL.exe and WseWsdl2.exe both generate in C#/VB.NET and both definitely generate asyn method pairs per web method. If you generated it by hand in C++ you'll need to do a little more work to get the async methods on there as well.

-Drew

Nov 21 '05 #3

P: n/a
rgarf wrote:
The proxy was generated automatically when I added the web service as
a reference to my C++ application, so it was generated in C++ by
Visual Studio. Do I have to add anything to the generated proxy to get
the asynchronous calls, I thought it should do it automatically?


Wow, wasn't even aware it generated proxies in C++ to be honest with you. Typically, yes, these methods are generated for you when using wsdl.exe. In fact, even though I rarely touch C++ anymore, I just went and crufted up a test app and if I look in the localhost.h file for the test web service i have setup I *do* see async methods:

<codeSnippet language="MC++">
/// <remarks/>
public: System::IAsyncResult * BeginReturnXmlNode(System::AsyncCallback * callback, System::Object * asyncState);

/// <remarks/>
public: System::Xml::XmlNode * EndReturnXmlNode(System::IAsyncResult * asyncResult);
</codeSnippet>

HTH,
Drew
Nov 21 '05 #4

P: n/a
My C++ application is a MFC application, was yours a .Net app, if yes could
be different.
So how can I do Asynchronous web method calls from my C++ application if my
proxy files does not have the begin & end functions?

"Drew Marsh" wrote:
rgarf wrote:
The proxy was generated automatically when I added the web service as
a reference to my C++ application, so it was generated in C++ by
Visual Studio. Do I have to add anything to the generated proxy to get
the asynchronous calls, I thought it should do it automatically?


Wow, wasn't even aware it generated proxies in C++ to be honest with you. Typically, yes, these methods are generated for you when using wsdl.exe. In fact, even though I rarely touch C++ anymore, I just went and crufted up a test app and if I look in the localhost.h file for the test web service i have setup I *do* see async methods:

<codeSnippet language="MC++">
/// <remarks/>
public: System::IAsyncResult * BeginReturnXmlNode(System::AsyncCallback * callback, System::Object * asyncState);

/// <remarks/>
public: System::Xml::XmlNode * EndReturnXmlNode(System::IAsyncResult * asyncResult);
</codeSnippet>

HTH,
Drew

Nov 21 '05 #5

P: n/a
rgarf wrote:
My C++ application is a MFC application, was yours a .Net app, if yes
could
be different.
So how can I do Asynchronous web method calls from my C++ application
if my
proxy files does not have the begin & end functions?


Yes, mine was an MC++ .NET WinForms app. I just tried a no MC++ app, just Win32, and it appears the logic behind "Add Web Reference" in that type of project is a completely different beast. It couldn't even handle some simple XSD stuff I had defined. Once I commented that the schema that was causing problems for it, I found exactly what you found: no async methods. This makes sense though, because you're no longer using .NET which comes with async built right in. Therefore it looks like you'd have to emulate it yourself by managing your own threads when using pure C++.

HTH,
Drew
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.