C++ Consuming Web Services

Jul 16, 2010 at 3:41pm
Hi,

I've not got any experience in developing C++ but I'm trying to help a developer call a web service I've written in VB.NET. One of the methods is named GetNextImageForSuitabilityCheck() and doesn't take any parameters. However, according to the header file that has been created for the service, the method expects a couple of parameters. See below for the code in the header file.

HRESULT GetNextImageForSuitabilityCheck(
ImageSuitabilityRequest* GetNextImageForSuitabilityCheckResult
);

Therefore, when we call the method in code without passing parameters, the following error occurs:

error C2660: 'MoleTestWSClass::CMoleTestWSClassT<>::GetNextImageForSuitabilityCheck' : function does not take 0 arguments

Please can someone help me out with this? I'm sorry for the vagueness of this post but when it comes to C++ I don't have a clue but I'm giving all the information I have available.

Thanks,

Tim
Jul 16, 2010 at 4:42pm
How can the method both take no parameters and take 1 parameter at the same time?
Jul 16, 2010 at 4:48pm
The method in the webservice has been written to take 0 parameters. So when I call it in C# or VB.NET, it doesn't need any parameters.

.i.e.

_Image_ImageSuitabilityRequest = _WS_MoleTestWSClass.GetNextImageForSuitabilityCheck();

However, it's in C++ where it complains when no parameters are passed in. That's the question I asked and would like an answer to.
Jul 16, 2010 at 4:51pm
closed account (oz10RXSz)
Because probably in C# or VB.NET there is another layer of abstraction that provides this argument by itself, so that you do not need to do it by hand in those languages. So this is not the problem of C++ here, but rather reading the documentation of web services in .NET. Webservices are usually not called directly - there is usually a huge amount of code that is responsible for creating, sending, receiving and parsing the requests.
Last edited on Jul 16, 2010 at 4:52pm
Jul 16, 2010 at 4:59pm
I appreciate your response and it gives me more information on how web services are handled in different languages.

However, I really need to know what to do to resolve the problem. Can someone please tell me how to solve the problem?

Thanks.
Jul 16, 2010 at 5:06pm
closed account (oz10RXSz)
Have you tried this:
http://gsoap2.sourceforge.net/
Jul 16, 2010 at 5:11pm
Apparently, whatever you're using transforms the functions so that the return value is passed through a parameter and the new return value of the function just indicates whether the call could be performed correctly.

So the call could look like this:
1
2
ImageSuitabilityRequest request;
HRESULT res=GetNextImageForSuitabilityCheck(&request);


Still, it seems odd that this requires the construction of a temporary object.
You really should read the documentation for the program that does this transformation.
Jul 19, 2010 at 1:37pm
Thanks for your feedback guys, I've fed this back to the C++ developer I've been dealing with and hopefully the problem will be sorted.

Cheers,

Tim
Topic archived. No new replies allowed.