Click here to Skip to main content
Click here to Skip to main content

Creating a gSoap eBay Client Application with Visual C++ 2008

By , 28 Oct 2008
 

Introduction

One would think that writing a client application using the Simple Object Access Protocol (SOAP) in Visual C++ would be a non-trivial task. SOAP interface calls are (more or less) human-readable text transported across HTTP, a ubiquitous Internet transport protocol. It should be a simple matter of putting together the proper data payload, wrapped in properly formatted HTTP and SOAP headers, and sending the message across the wire, taking into account SSL security. The reality is interacting with eBay using SOAP and C++ is not as straightforward as one might think.

First, despite being the most widely used programming language that has ever existed in the history of mankind and its universal support on every modern computing platform, eBay has chosen not to support C++. There are no code examples for C++. Support queries regarding C++ are either summarily ignored, or responses refer to non-C++ examples. Second, eBay does not strictly adhere to the W3C SOAP standard. This is seen in two distinct areas, which will be covered later in this document. Lastly, the sheer size of the API is overwhelming, both intellectually and technically. Add to that, a clunky developer support website, poor API documentation, and nebulous, if not completely incorrect, server error messages. Any one of these would give the average developer a headache.

This article describes the process for creating a basic application for interacting with eBay using SOAP in Visual C++. The application will retrieve the official eBay time from the eBay server using Visual C++ 2008, gSOAP, OpenSSL, and the eBay API.

Step 1: Use gSOAP

Download gSOAP from Sourceforge. I have used gsoap_2.7.11.tar.gz, released July 27, 2008. This file contains the precompiled Windows binaries and the required source. Uncompress the archive to your hard drive. Assuming you’re running Windows, once uncompressed, gSOAP is ready to run. The precompiled binaries will work perfectly. There’s no need to (re-)compile gSOAP.

Step 2: Compiling WSDL

Here is the command line to compile the WSDL:

wsdl2h -I \gsoap-2.7\gsoap\WS -f -k -o 
  eBaySvc.h http://developer.ebay.com/webservices/latest/eBaySvc.wsdl

wsdl2h.exe is the parser application provided by gSoap. The –I parameter tells the parser where to find the required gSoap include files. The –f parameter tells the compiler to generate C++ code (as opposed to C code). The –o parameter specifies the name of the output file. The path at the end is the URI to the eBay SOAP API WSDL file. This process will take some time, as the first thing the tool will do is download the latest version of the 3.7 MB eBaySvc.wsdl file.

As previously mentioned, eBay does not strictly adhere to the W3C SOAP standard, necessitating the use of the –k parameter. The -k parameter tells gSOAP not to generate “mustUnderstand” qualifiers. From W3C:

The SOAP mustUnderstand global attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process. The recipient of a header entry is defined by the SOAP actor attribute. The value of the mustUnderstand attribute is either "1" or "0". The absence of the SOAP mustUnderstand attribute is semantically equivalent to its presence with the value "0". […] The SOAP mustUnderstand attribute allows for robust evolution. Elements tagged with the SOAP mustUnderstand attribute with a value of "1" must be presumed to somehow modify the semantics of their parent or peer elements. Tagging elements in this manner assures that this change in semantics will not be silently (and, presumably, erroneously) ignored by those who may not fully understand it.

If you send “mustUnderstand” to eBay, the server will return an error. eBay doesn’t understand mustUnderstand.

Successful compilation will produce eBaySvc.h.

Step 3: Generating C++ Stubs

Here is the command line to generate the C++ stubs:

soapcpp2 -C -L -I \gsoap-2.7\gsoap\import -w -x eBaySvc.h

soapcpp2.exe is the C++ stub generator application provided by gSOAP. The –C parameter tells the generator to produce client-side code only. (eBay is server-side.) The –L parameter tells the generator not to produce soapClientLib.cpp. (This file can be used to create a static library rather than include the SOAP code directly in your project. Creation of a static library is beyond the scope of this document.) The –I parameter specifies the include file path. The –w parameter tells the generator not to produce schema files. The –x parameter tells the generator not to produce XML message files. In general, I tried to have this tool and wsdl2h.exe do as little work as possible.

Step 4: Open SSL

gSOAP depends upon Open SSL for SSL-secured communications. You will need to download and compile Open SSL to access eBay. Alternatively, Shining Light Productions produces an Open SSL installer. I haven’t used it myself, but it looks like it may prevent the need to compile Open SSL.

Step 5: Visual C++ 2008

For simplicity, create a C++ Win32 Console Application project. Accept all of the default settings.

Step 5a: Add Code Here

Add the following files that were generated by gSOAP to the project:

  • eBayAPISoapBinding.nsmap
  • soapC.cpp
  • soapClient.cpp
  • soapeBayAPISoapBindingProxy.h
  • soapH.h
  • soapStub.h

Add the following files from the gSOAP directory to the project:

  • stdsoap2.cpp
  • stdsoap2.h

Step 5b: File Options

The .cpp files generated by gSOAP from the eBay WSDL are quite large. They will need special handling in Visual Studio. Right click on the file soapC.cpp (only) in the Solution Explorer, and select Properties from the right click menu. Under Configuration Properties and C/C++ tree nodes, select Command Line. In the panel on the right, enter “/bigobj” and click Apply.

Next, under Configuration Properties and Precompiled Headers, change the option for Create/Use Precompiled Header to “Not Using Precompiled Headers”. This will allow the project to use precompiled headers excluding this file. Click Apply.

Repeat this process for soapClient.cpp.

Use the process above to disable the use of precompiled headers for stdsoap2.cpp. (The “/bigobj” command line compiler parameter is not needed for stdsoap2.cpp.)

Step 5c: Project Options

  • Right click on the project and select Properties from the right click menu. Under Configuration Properties, C/C++ and General, add include paths to gSOAP and Open SSL. Click Apply.
  • Under Configuration Properties, C/C++ and Preprocessor, add “WITH_OPENSSL” (to enable SSL in gSOAP) and “DEBUG” (to enable logging) to the list of Preprocessor Definitions. Click Apply.
  • Under Configuration Properties, Linker and General, add the path to the Open SSL binary directory, where the compiled lib files reside, to Additional Library Directories. Click Apply.
  • Under Configuration Properties, Linker and Input, add “libeay32.lib” and “ssleay32.lib” to Additional Dependencies. These are the Open SSL libraries. Click Apply.

Step 5d: Time to Write Code! (OK, not really.)

Open the console application C++ file. Add three #includes to the top of the file just after the stdafx.h include:

#include "soapeBayAPISoapBindingProxy.h"
#include "eBayAPISoapBinding.nsmap"
#include "stdsoap2.h" 

Step 5e: Test Build

It’s now time to test to see if everything has been done correctly so far. Build the solution. At this point, the solution should build with 0 errors and 0 warnings. If not, you’ve missed a step above.

Step 5f: Interact with eBay

Using your preferred web browser, go to http://developer.ebay.com. You will need to:

  1. Establish a developer account.
  2. Generate a set of sandbox keys (AppId, DevId, and CertId – also known as an AuthCert).
  3. Register a user account in the Sandbox.
  4. Get a user token.
  5. Use the API Test Tool to verify that you have all of the above.

The exact procedure for accomplishing the above is left as an exercise for the reader. Go forth and experience the clunkiness that is eBay for yourself.

Step 5g: SOAP Configuration

Although gSOAP supports SSL, SSL is not configured out of the box. To configure SSL, you’ll need a file containing the public certificates of trusted certification authorities. gSOAP provides this file. You can download it from here.

Once you have this file, code configuration is needed. Open soapeBayAPISoapBindingProxy.h. Just after the soap_new() call, add the following code:

soap_ssl_init();
if (soap_ssl_client_context(soap, SOAP_SSL_DEFAULT, NULL, NULL, 
    "C:\\Path\\To\\Certs\\File\\cacerts.pem", NULL, NULL ))
{
     soap_print_fault(soap, stderr);
}

Be sure to update the path to the unarchived cacerts.pem file to match your system.

Warning: The code above was added to a tool-generated file. If you re-run the tool, this change will be over-written. You will need to re-add this code.

Step 5g: Time to Write Code! (Really, this time!)

We’re finally ready to do something meaningful. First, input all of the values obtained in Step 5f above into your application main(). For example:

std::string sAppId("<your />");
std::string sDevId("<your />");
std::string sCertId("<your />");
std::string sUserToken("<your />"); 

Next, declare the eBay proxy object and configure the SOAP header:

eBayAPISoapBinding eBayProxy;
eBayProxy.soap->header = new SOAP_ENV__Header;
eBayProxy.soap->header->ns1__RequesterCredentials = new ns1__CustomSecurityHeaderType;
eBayProxy.soap->header->ns1__RequesterCredentials->eBayAuthToken = &sUserToken;
eBayProxy.soap->header->ns1__RequesterCredentials->Credentials = new ns1__UserIdPasswordType;
eBayProxy.soap->header->ns1__RequesterCredentials->Credentials->AppId = &sAppId;
eBayProxy.soap->header->ns1__RequesterCredentials->Credentials->DevId = &sDevId;
eBayProxy.soap->header->ns1__RequesterCredentials->Credentials->AuthCert = &sAuthCert; 

Prepare the request and response objects:

ns1__GeteBayOfficialTimeRequestType req;
ns1__GeteBayOfficialTimeResponseType resp;

std::string sVersion("577");
req.Version = &sVersion;

req.DetailLevel.push_back(ns1__DetailLevelCodeType__ReturnAll);

std::string sLanguage("en_US");
req.ErrorLanguage = & sLanguage;

The following is the second area where eBay does not adhere to the W3C SOAP standard. With SOAP, parameters should be part of the data payload posted via HTTP. eBay, however, requires that some of the data payload parameters be repeated on the URL to which the SOAP call is posted. (I don’t know why this duplication is needed. Attempts to get an answer from eBay have gone unanswered.)

Therefore, the next step is to hack the app ID and other parameters into the endpoint URL.

eBayProxy.endpoint = "https://api.sandbox.ebay.com/wsapi?callname=GeteBayOfficialTime&
   siteid=0&appid=<your>&version=577&routing=default";

Finally, you make the call!

int err = eBayProxy.__ns1__GeteBayOfficialTime( &req, &resp );
if( err == SOAP_OK )
{
    // do something with the response
}
else
{
    // do something in response to the error
}

Step 5h: Build Again

The result of the compilation should result in 0 errors, 0 warnings. Life is good!

Step 5i: Configure Dependencies

The sample application will require the Open SSL DLLs libeay32.dll and ssleay32.dll to be copied to the project directory.

Step 5j: Run, Forrest! Run!

Press F5 to run the application in the debugger. You should see a command prompt window open, a short delay, then the command prompt window will close. Check your project directory for three files: TEST.LOG, SENT.LOG, and RECV.LOG. The largest file, TEST.LOG will contain gSOAP trace output. In my testing, this file hasn’t been useful, but I’m not developing gSOAP. SENT.LOG contains what was sent to the eBay server, including the target, action, HTTP headers, and the XML data payload. RECV.LOG contains what was received from the eBay server. These files have been included in the sample project for review.

Note that the XML received from eBay contains the timestamp in the following format:

<timestamp>2008-08-20T18:06:24.565Z<timestamp />

The gSOAP response object, however, will provide the programmer a 4-byte time_t value, having already parsed the XML and converted the text value to C++ friendly binary data.

That’s it. Congratulations! You did all this for four bytes.

FAQ

  • Q1: Why Visual Studio 2008?
  • A1: There are actually two questions in this one question:
    • Q1.1: Why Visual C++ as opposed to another C++?
    • A1.1: My only answer is that my client required Visual C++ for the application I was working on at the time, so that's what I used to create the example application and the article. Implementation using a flavor of C++ other than Visual C++ is left as an exercise for the reader.
    • Q1.2: Why Visual C++ 2008 and not earlier versions?
    • A1.2: Versions of Visual C++ earlier than 2008 (VC++ compiler version 9.0) will not compile the source files generated from the eBay WDSL file. The source files are so large that they will overwhelm the compilers in VS 2003 and VS 2005. The VC++ 2008 compiler supports the /bigobj flag, not in previous versions.

History

  • 29 October 2008 - Added FAQ and the first question.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Kevin Yochum
Software Developer (Senior)
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionGreat Article, gSOAP 2.8memberpdlm19 Dec '12 - 12:51 
Hi Kevin,
 
Thank you for a great article. It really gives me a chance to jump start.
 
I am using gSOAP 2.8 and got a linking error on soap_in_xsd__duration(..) and soap_out_xsd__duration(..)
 
What might be the problem here?
 
Thanks!!
 
Paul
 
...
1>soapC.obj : error LNK2019: unresolved external symbol "__int64 * __cdecl soap_in_xsd__duration(struct soap *,char const *,__int64 *,char const *)" (?soap_in_xsd__duration@@YAPA_JPAUsoap@@PBDPA_J1@Z) referenced in function _soap_getelement
1>soapC.obj : error LNK2019: unresolved external symbol "int __cdecl soap_out_xsd__duration(struct soap *,char const *,int,__int64 const *,char const *)" (?soap_out_xsd__duration@@YAHPAUsoap@@PBDHPB_J1@Z) referenced in function _soap_putelement

AnswerRe: Great Article, gSOAP 2.8memberKevin Yochum16 Jan '13 - 5:32 
Paul,
 
Thank you for reporting this problem. I haven't used gSoap or the eBay API recently. I had no idea there was an issue.
 
Somewhere between versions 2.7.11 and 2.8.12, gSoap made changes that cause soapcpp2.exe to generate c++ code for the eBay service that relies on the duration custom serializer. (Alternatively, perhaps the eBay API changed to require the duration custom serializer. I can't say which.) The duration serializer can be found in the gSoap-2.8/gsoap/custom directory. I first noticed there was a problem when attempting to run soapcpp2.exe and an additional include directory was required on the command line. (You probably noticed the same, if you got to a point where you received linker errors.) The new command line looks something like:
 
soapcpp2.exe -C -L -I gsoap-2.8\gsoap\import;gsoap-2.8\gsoap -w -x eBaySvc.h
 
The question now is how to update the project to compile again. Looking at the README.txt in the gsoap/custom directory, step 1 is to include the .h file of the serializer you want to use in soapH.h. For example:
 
#ifndef soapH_H
#define soapH_H
#include "soapStub.h"
#include "custom/duration.h" // << Added by Kevin
#ifndef WITH_NOIDREF
 
Keep in mind that this line is being added to a source file that was generated by soapcpp2.exe. If you run the tool again, it will overwrite this addition.
 
When I attempt to include duration.h, I get a compiler error. There is only one line of non-comment code in duration.h:
 
extern typedef long long xsd__duration;
 
The error is:
 
error C2159: more than one storage class specified
 
This would appear to be a bug in gSoap, as Visual C++ will certainly not compile this code. I deleted the 'extern' storage class specifier to get it to build. I hate having to modify the code from a library, but I saw little choice. Perhaps someone else has another solution.
 
After changing duration.h, I recompiled. The project built with one ("possible loss of data") warning in soapClient, but no errors.
 
I'll update the article sometime over the next week or so to reflect these changes. I was using Visual Studio 2010 in my research.
 
Let me know if you have any questions or problems!
 
Kevin
QuestionCan you help me out with an SSL question?memberMember 34553984 Jul '12 - 11:15 
Hello Kevin,
I have downloaded and installed gSoap.
I have downloaded and installed OPENSSL.
I hvae downloaded the wsdl file I need and all of the associated XSD files.
Actually, the wsdl and xsd files were all sent to me by the third party Vendor.
I have one wsdl file and 134 xsd files.
 
I have put all of these files (wsdl and xsd) into the gsoap binary folder where the wsdl2h executable exists.
 
Then I opened a cmd window and tried to run wsdl2h on the wsdl file, but I see an error message:
"Cannot connect to https site: no SSL support, please rebuild with SSL (default) or download the files and rerun wsdl2h".
 
Can you suggest anything?
 
Thanks
GeneralRe: Can you help me out with an SSL question? [modified]memberKevin Yochum5 Jul '12 - 9:35 
Personally, I wouldn't copy anything to the gSoap binary folder. I'd put my wsdl into its own folder, then reference wsdl2h. It's cleaner. That's me though. I doubt that's the problem.
 
What is your wsdl2h command line? Right off hand, I am at a loss as to why wsdl2h is looking for SSL since all of the files are local.
 
Kevin

-- modified 6 Jul '12 - 9:48.
GeneralRe: Can you help me out with an SSL question?memberconacher6 Jul '12 - 3:51 
Hello Kevin,
I copied all of the XSD and WSDL files to that folder to be sure I was not missing anything.
I had tried with the files in their own folder inside the project.
Anyway, I originally received the XSD and WSDL from the Vendor. There are about 75 files.
But, after having these issues, I ran svcutil /t:metadata https://vendorurl.svc?wsdl to grab all of the schema files, and only received about five or six. I assume that svcutil will not get all of the includes, or maybe all of the imports? Maybe that is why WSDL2H is trying to establish the SSL connection?
 
I opened the URL in a browser session to get the WSDL.
https://VendorUrl/Service.svc/mex?wsdl
 
I simply ran WSDL2J -O HcaiWsdlInclude.h from the command line.
The error message generated is "Cannot connect to https site: no SSL support, please rebuild with SSL (default) or download the files and rerun wsdl2h"
 
I tried to invoke gSoap from within SoapUI, but failed there.
I presume I need to rebuild the gSoap binaries to include SSL support, but I am not sure where to start with that yet.
(And I am hoping someone jumps in to say, yep, that's what you need to do) Smile | :)
 
Thanks
QuestionHow to implement WCF Callback webservice through gsoapmembermanas4u12 Feb '09 - 4:05 
Hi ,
 
I have a WCF web service that implements a Callback contract which enables the server to make function call into clients asynchronously. I need to implement the client in C++ using gSoap.
 
This is what i have done till now.
 
a) Generated stub and proxy by supplying the wsdl file.
b) The generated files does not contain the interface which we need to implement at client whose function call will be invoked.
c) I can see the function present in gsoap generated files but dont know how to use it to make it work as callback..
 
Kindly let me know.
My email id is mohitmanaskant@yahoo.com
 
Thanks in advance,
Mohit
RantRe: How to implement WCF Callback webservice through gsoapmemberKevin Yochum12 Feb '09 - 7:44 
Mohit,
 
As your post does not involve eBay, it is off topic.
 
Having said that, I don't think gSOAP supports what you are trying to do.
 
Kevin
GeneralExcellent!memberShup4 Feb '09 - 13:02 
Hi,
 
A wonderful job on describing how to quickly get started with utilizing SOAP in a application developed under VC++ 2008!
 
Worked wonders for me!
 
Regards,
 
Shup
Mind & Machines LTD

GeneralRe: Excellent!memberKevin Yochum5 Feb '09 - 3:22 
Thank you for the compliment. I'm happy I could help. Cheers!
GeneralExcellentmemberSonatica17 Jan '09 - 17:06 
Thank you for this article Kevin!!
 
I'm currently designing a C++/gsoap client to utilise a https soap server (slightly better behaved than eBay apparently), and found your article very helpful in overcoming the initial inertia.
 
+1 Karma to you. Cool | :cool:
 
modified on Saturday, January 17, 2009 11:17 PM

GeneralRe: ExcellentmemberKevin Yochum5 Feb '09 - 3:21 
You are welcome. Thank you for the compliment and the karma. I need all the karma points I can get, Smile | :)
Questionsteps for linking with openssl [modified]membercternoey21 Dec '08 - 21:39 
Your article has helped me a lot in terms of understand gsoap. (Thanks!)
 
Unfortuantely, I only have vc++2003, so I could not study your project settings in detail.
 
But I read your article very carefully and I made it through all the gsoap steps you explained.
 
However, I am still mystified about linking with openssl. Confused | :confused:
 
At first i tried to work directly with the source files for openssl.
 
That was completely overwhelming. Apparently you can not compile those source files without first installing a perl environment. And you are supposed to use MASM, which i have never tried.
 
So I followed your suggestion to try the setup tool on from Shinning Light Productions.
 
I have one directory of ".h" files to include for openssl and another for ".lib" to link.
 
It all seems just perfect to me.
 
But when I try to compile, I get exactly 4 linking errors....
 
Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
libeay32MTd.lib(randfile.obj) : error LNK2019: unresolved external symbol __stat64i32 referenced in function _stat
libeay32MTd.lib(by_dir.obj) : error LNK2001: unresolved external symbol __stat64i32
libeay32MTd.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __alloca_probe_16 referenced in function _OPENSSL_isservice
libeay32MTd.lib(b_print.obj) : error LNK2019: unresolved external symbol __ftol2_sse referenced in function _roundv
.\Debug_Unicode/SynergyMagic.exe : fatal error LNK1120: 3 unresolved externals
 
I guess I am leaving out a critical lib file of some sort. But I can not fathom which one it might be.
 
(fyi, i am on vc.net 2003)
 
Can you offer a suggestion?
 

Thanks in advance! (Your article is already super for the gsoap info alone)
 
-chris
 
modified on Monday, December 22, 2008 9:58 AM

AnswerRe: steps for linking with opensslmemberbovlk14 Jan '09 - 4:22 
Hello, I just run into the same linker errors when using OpenSSL with a completely different app and google found your question as the only meaningful response. This is how I finally solved the problem:
 
My project was linking against the static versions of libeay32MTd.lib and libeay32MTd.lib, which are located in the C:\OpenSSL\lib\VC\static\ directory. Removing the \static part of the path, I got it linking against the precompiled .DLL libraries that come with the OpenSSL for Windows distribution at
http://www.slproweb.com/products/Win32OpenSSL.html[^]
the Win32 OpenSSL v0.9.8j 7MB Installer link.
 
This solved the link problem.
QuestionDoes gSoap work with WCF ServicesmemberRenata3 Dec '08 - 4:35 
Hi!
 
I have a client/server application writen in C++ (unmanaged), but because of migration the server-side code to the .NET 3.5 Framework, I need to use gSoap for communication the client with the server (implemented with WCF service).
 
So, I wanna know does gSoap support WCF service with callback operations(Callback contracts) and can you give me a simple example or just a hint how to do that Confused | :confused: (this is really important for me for, so if someone knows, pls let me help Smile | :) )
 
Thanks a lot in advance.
 
Regards,
Renata
AnswerRe: Does gSoap work with WCF ServicesmemberKevin Yochum9 Dec '08 - 11:33 
Renata,
 
I'll contact you via e-mail, as your message is off-topic (i.e., does not deal with connecting to eBay with gSOAP).
 
Cheers,
 
Kevin
GeneralRe: Does gSoap work with WCF ServicesmemberRenata15 Dec '08 - 3:40 
Ok Kevin. You are right that this is not the appropriate place for that issue, so you can contact me via e-mail at reni84@gmail.com
I am expecting your mail.
 
Regards,
Renata
GeneralDisabling Security Alert WindowmemberWahaj Khan3 Dec '08 - 2:22 
Hi
I need to disable Security Alert Windows that come as a result of "untrusted certificate". I get popup window "Security Alert" about untrusted certificate: I need to disable or no more come this using SOAP in Visual C++ 6.0
 
Thanks and Regards
Wahaj Khan
GeneralRe: Disabling Security Alert WindowmemberKevin Yochum9 Dec '08 - 11:34 
Are you getting this message when attempting to communicate with eBay using gSOAP? Are you using gSOAP at all?
 
Kevin
GeneralRe: Disabling Security Alert WindowmemberWahaj Khan10 Dec '08 - 23:36 
Hi,
We are not using gSOAP. We are using Soap3.0 toolkit for all our purpose
Thanks
GeneralRe: Disabling Security Alert WindowmemberKevin Yochum11 Dec '08 - 1:45 
In that case, your post is off topic. Perhaps a Soap 3.0 toolkit forum would be more appropriate.
Good luck!
Generalarray of objectsmemberharbuz200227 Nov '08 - 3:19 
I have a web service developed in .NET which has two methods:
 
public int Test1(out object[] result)
public int Test2(object[] inObjects, out int[] results)
 
I also developed a client in C++ using VS 2005 and gSoap.
 

first case: Test1 method. The gSoap generates a class called _ns1__Test1Response which has a member (ns1__ArrayOfAnyType *result; ) for the result array of objects and this ns1__ArrayOfAnyType class has a member (std::vector<char * >anyType; ) which will contain the values received from the web service.
If one element from the object array it's itself an array, I received something like this on the client side:
<anyType xsi:type="xsd:double">1.23</anyType><anyType xsi:nil="true" /><anyType xsi:type="xsd:string">asdfghjkl;</anyType>
 
How can deserialize this data so I can obtain the "real" values and types from the above string using gSoap functions?
 

second case: Test2 method. The gSoap generates a class called _ns1__Test2 which has a member (ns1__ArrayOfAnyType *inObjects; ) for the data to be sent to the web service and this ns1__ArrayOfAnyType class has a member (std::vector<char * >anyType; ) which should contain the values sent to the web service. I've filled this anyType array with some values but the web service receives an array of objects of type System.Xml.XmlNode and every element is itself an array of two objects: an System.Xml.XmlAttribute and a System.Xml.XmlText.
 
How can I serialize the data to be sent, so the web service will receive an array of objects with the values sent to it not the XmlNode objects?
How can I serialize this data so I can send the values of different types to the web service (first value of int type, second one as string type, etc)?
GeneralRe: array of objects [modified]memberKevin Yochum1 Dec '08 - 2:50 
Your post does not concern using gSOAP with eBay. Perhaps a general gSOAP forum would be a more appropriate (and helpful) place to post your question.
 
Having said that, I suspect you are on your own to serialize and deserialize anything of type object. How can you expect gSOAP know how to serialize and deserialize something that's unspecified at code generation time when the gSOAP bindings are created (much less at runtime)? The gSOAP docs say that "gSOAP is the only SOAP/XML toolkit that supports a purely native C/C++ data binding to XML using automatic mappings for user-defined C and C++ data types." Rather than passing an array of type object (which is sometimes a double and sometimes a string in your example), create a structure of C/C++ types (perhaps with one string member and one double member) and pass an array of that structure. gSOAP should serialize and deserialize this structure for you. This assumes that you have control over both the client and web service to be able to change the protocol, of course. If you don't have control over the protocol, I'm not sure what the answer is, other than to serialize and deserialize manually.
 
modified on Thursday, December 11, 2008 8:35 AM

General/bigobj is in VS2005memberM Towler3 Nov '08 - 22:25 
According to MSDN the /bigobj option is present in VS2005 as well as VS2008.
 
http://msdn.microsoft.com/en-us/library/ms173499(VS.80).aspx[^]
GeneralRe: /bigobj is in VS2005memberKevin Yochum4 Nov '08 - 3:17 
Thank you for pointing that out. I'll update the article shortly. Perhaps it will work in VS 2005, after all.
 
D'Oh! | :doh:
 
Kevin
GeneralVery instructivememberwyndella3 Nov '08 - 15:06 
I don't use SOAP (not that I'm one of the great unwashed) and I can't abide ebay but this is a great article and
very instructive. Well done K.

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 28 Oct 2008
Article Copyright 2008 by Kevin Yochum
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid