I am trying to load some XML data into C++ code (classes) using gsoap. In the examples they have in the documentation they talk about loading web services documents to C++ headers (wsdl2h); but there were no explicit examples using XML files directly. Anyways, I installed gsoap (using pre-compiled binaries) and tried as a first step, doing:
wsld2h -o <myexample_cpp.h> <myexample.xml>
and I got:
../../bin/linux386/wsdl2h: ../../bin/linux386/wsdl2h: cannot execute binary file
As a last note, I am testing this in Cygwin (using the linux binary), but I doubt that might contribute to any error. Also I wanted to know if the XML file has to have the “xml” extension in order for it to work? Appreciate if anyone with some ideas can share their experiences.
Edit:
Actually this could be due to running the linux pre-compiled binary on cygwin. Anyway I tried this from the Windows command line instead and I got what appears to be a legitimate error:
<path/to>\tests\gsoap>..\..\bin\win32\wsdl2h.exe -o myexample_soap_cpp.h myexample.xml
** The gSOAP WSDL/Schema processor for C and C++, wsdl2h release 2.8.5
** Copyright (C) 2000-2011 Robert van Engelen, Genivia Inc.
** All Rights Reserved. This product is provided "as is", without any warranty.
** The wsdl2h tool is released under one of the following two licenses:
** GPL or the commercial license by Genivia Inc. Use option -l for details.
Saving myexample_soap_cpp.h
Cannot open file 'typemap.dat'
Problem reading type map file 'typemap.dat'.
Using internal type definitions for C++ instead.
Reading file 'myexample.xml'...
An error occurred while parsing WSDL or XSD from 'myexample.xml'
Error 3 fault: SOAP-ENV:Client [no subcode]
"Validation constraint violation: tag name or namespace mismatch in element 'ns4:xmlDocument'"
Detail: [no detail]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns4:xmlDocument xmlns="http://purl.org/dc/terms/" xmlns:ns2="http://www.w3.org/1999/xlink" xmlns:ns3="http://www.opengis.net/gml/3.2" xmlns:ns4="h
/www.isotc211.org/2005/gmd" xmlns:ns7="http://www.<my_website>" version="1.1.0.0(XML)">
<title>myexample</title>
<creator>l0352955</creator>
<publisher>blah</publisher>
<created xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="W3CDTF">2011-07-25T10:43:26.622+02:00</created>
<format>XML/HDF</format>
<ns4:areaOfInterest ns3:id="AreaOfInterest">
<ns3:description>Some description</ns3:description>
<ns3:boundedBy>
<ns3:Envelope>
<ns3:lowerCorner>427875.13794 6736113.80757</ns3:lowerCorner>
<ns3:upperCorner>436165.54057 6747905.74672</ns3:upperCorner>
</ns3:Envelope>
</ns3:boundedBy>
<ns4:outline>
<ns3:SomeShape ns3:id="ShapeOfInterest">
<ns3:exterior>
<ns3:Linear>
<ns3:pos>431960.26388 6736113.80757</ns3:pos>
<ns3:pos>436165.54057 6737898.90462</ns3:pos>
<ns3:pos>431960.26388
Actually, I resolved this. The problem was the usage. I need to be issuing the wsdl2h executable with the XSD schemas as argument, not the XML files. That fixes all the errors (I tested this only on Windows 64 bit Vista). Thanks.