2011-12-13 33 views
0

gsoapを使用してXMLデータをC++コード(クラス)にロードしようとしています。これらの例では、ドキュメントでC++ヘッダー(wsdl2h)にWebサービスドキュメントをロードする方法について説明しています。 XMLファイルを直接使用する明示的な例はありませんでした。とにかく、私はのgSOAP(コンパイル済みのバイナリを使用して)をインストールしてやって、最初のステップとして試み:gsoapでXMLデータを生成してC++コードを生成する

wsld2h -o <myexample_cpp.h> <myexample.xml> 

をし、私が得た:最後の注意点としては

../../bin/linux386/wsdl2h: ../../bin/linux386/wsdl2h: cannot execute binary file 

を、私はCygwinのでこれをテストしてい(freshmeat_linux/Linuxバイナリを使用して)、私はそれが任意のエラーに貢献する可能性が疑問です。また、XMLファイルが機能するためには、拡張子 "xml"を持っている必要があるかどうかを知りたかったのですが?いくつかのアイデアを持っている人なら誰でも自分の経験を分かち合うことができます。

編集: これは実際にcygwinでlinuxのプリコンパイルされたバイナリを実行している可能性があります。とにかく私の代わりにWindowsのコマンドラインからこれを試してみました、私は合法的な誤りと思われるものを得た:

<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 
+1

実際、私はこれを解決しました。問題は使い方だった。 XMLファイルではなく、引数としてXSDスキーマを使用してwsdl2h実行可能ファイルを発行する必要があります。これですべてのエラーが修正されました(私はこれをWindows 64ビットVistaでのみテストしました)。ありがとう。 –

+0

それを答えとして投稿してください。 –

答えて

0

実は、私はこれを解決しました。問題は使い方だった。 XMLファイルではなく、引数としてXSDスキーマを使用してwsdl2h実行可能ファイルを発行する必要があります。これですべてのエラーが修正されました(私はこれをWindows 64ビットVistaでのみテストしました)。ありがとう。