I tried to build with -DWITH_DOM, since I notice there're some lines in stdsoap2.cpp can only be reached if WITH_DOM is defined. However, when I use GDB run my program, those lines were skipped as if WITH_DOM is not defined. What is the problem?
Any advice, Prof. Engelen :) Gao --- In gsoap@yahoogroups.com, ". ." <sga...@...> wrote: > > Hi, > > I am new to gSOAP. I tried to deserialize a XML file like below: > <Client> > <TargetCode key="ZipPlus4">12345-6789</TargetCode> > <TargetCode key="Gender">Male</TargetCode> > </Client> > > The "Client" object I got has no value for the "TargetCode" element's data > (in this case, "12345-6789" and "Male"). If I serialize the object, I get: > <Client> > <TargetCode key="ZipPlus4"></TargetCode> > <TargetCode key="Gender"></TargetCode> > </Client> > > I tried wsdl2h with -d option, linked dom.cpp when compiling, but I still > cannot make it work. Anyone can give me a hand? My test program is simple: > > int main() > { > soap_dom_element dom; > dom.soap = soap_new1(SOAP_DOM_NODE); > ns2__PlacementRequestType *aPlaceReq = NULL; > soap_init(dom.soap); > soap_begin(dom.soap); > std::fstream fileStream; > fileStream.open("client.xml", std::fstream::in); > dom.soap->is = &fileStream; > soap_begin_recv(dom.soap); > if ((aPlaceReq = soap_get_ns2__ClientType(dom.soap, NULL, NULL, NULL)) > == NULL) > { > // error > std::cout << "Error in deserializing the input." << std::endl; > return 0; > } > > soap_end_recv(dom.soap); > > // Serialize to validate. > std::fstream vfileStream; > vfileStream.open("vtest.xml", std::fstream::out); > dom.soap->os = &vfileStream; > soap_begin_send(dom.soap); > aPlaceReq->soap_serialize(dom.soap); > aPlaceReq->soap_put(dom.soap, "client", NULL); > soap_end_send(dom.soap); > > // clean up > soap_destroy(dom.soap); > soap_end(dom.soap); > soap_done(dom.soap); > fileStream.close(); > > return 0; > } > > I compile it with command "g++ -o test test.cpp soapC.cpp dom.cpp -lgsoap++" > > Thanks in advance!! > > Gao >