开发者

Issues compiling vmware web api client code into useable objects

开发者 https://www.devze.com 2023-03-06 06:07 出处:网络
I\'m using vmware\'s web application api in an attempt just to simply retrieve the fields in the \"ServiceContent\" object. There is an example of how this should be accomplished located at the vmware

I'm using vmware's web application api in an attempt just to simply retrieve the fields in the "ServiceContent" object. There is an example of how this should be accomplished located at the vmware forum. The example contained there compiles fine for me however I get segfaults when running the simple example - specifically the trace goes back to the soap_serializeheader() function (I believe these are defined in stdsoap2.cpp). My problem is that I do not know how to avoid this segfault and have no idea why this is occurring (as I am following the example almost word for word). I am using OS X tool chain (gcc version 4.0.1 (Apple Inc. build 5465) ) combined with (gsoap release 2.7.16). I tried gsoap 2.8 but got the same result. Below is the procedure I used to get to where I am now.

These are the commands I used to parse the wsdl:

wsdl2h -o vim25.h vimService.wsdl

Once this is parsed, I compiled using the following command:

soapcpp2 -x -C -pvsp vim25.h -I/place/where/stlvector.h/is

this generates files vspC.cpp, vspClient.cpp, and vspVimBindingProxy.cpp. Internally these files have the same prefixes for functions (i.e. ns1/ns2 etc) so my calls are the same as those in the example.

This is the command I am using to compile vspC.cpp and vspClient.cpp:

g++ -DWITH_COOKIES -DWITH_OPENSSL -c vspC.cpp
g++ -DWITH_COOKIES -DWITH_OPENSSL -c vspClient.cpp

This is the command I use to compile stdsoap2.cpp (if I do not compile with -DWITH_NONAMESPACES I get an error about an undefined symbol "_namepspaces" when I link everything):

g++ -DWITH_COOKIES -DWITH_OPENSSL -DWITH_NONAMESPACES -c stdsoap2.cpp

I then link everything together with the test code (again this is copied almost identically from the example, just with the changes to correctly refer to the files I created):

g++ -DWITH_COOKIES -DWITH_OPENSSL vspC.o vcpClient.o stdsoap2.o testcase.cpp -lssl -lcrypto -o doesntwork

This compiles correctly, but of course fails to run. I read about an OS X user in this vmware forum post who 开发者_如何学运维was also having trouble. It appears the gsoap guide says you cannot use stdsoap2.cpp's header and fault serialization codes, and you must compile them separately. The user in the OS X post seems to have done this, however I am not sure how to incorporate them into my test file (he creates the empty env.h file and then compiles it with soap2cpp) - if I include the envH.h file i get about naming conflicts with vspH.h. So a second question would be how do I use soap2cpp to compile all the stubs correctly so that there are not namespace conflicts (which is what I appear to be encountering).

I will not provide the source, as it is displayed at the first vwmare forum link by user stumpr. I do not believe the issue is in the source, but in the way I have used either wsdl2h, soap2cpp, or some incorrect combination of flags during compilation with g++.

Thanks for taking a look, and hopefully some one can resolve the issue!

EDIT I think I may have solved this - by using a 64bit system (and one with more memory). I tried compiling with -m32 on the X.6 and it was not able to do it (complaining about memory issues).

Hopefully someone will stumble upon this and be happy to know the answer.

0

精彩评论

暂无评论...
验证码 换一张
取 消