2012-02-09 8 views
0

PHPソープ関数を構築し、配列の配列を受け取ってファイルに書き出しました。ここでmultimensionnal stl :: vectorまたは配列をgSoapで送信する

は、SOAPサーバーのWSDLファイルです:

This XML file does not appear to have any style information associated with it. The  document tree is shown below. 
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="ADRESSE_WEBSERVICE"  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap- enc="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="BoWS"  targetNamespace="ADRESSE_WEBSERVICE"> 
<types> 
<xsd:schema targetNamespace="ADRESSE_WEBSERVICE"/> 
</types> 
<portType name="BoWSPort"> 
<operation name="writeArray"> 
<documentation>This method count and write an array</documentation> 
<input message="tns:writeArrayIn"/> 
<output message="tns:writeArrayOut"/> 
</operation> 
</portType> 
<binding name="BoWSBinding" type="tns:BoWSPort"> 
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
<operation name="writeArray"> 
<soap:operation soapAction="ADRESSE_WEBSERVICE#writeArray"/> 
<input> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="ADRESSE_WEBSERVICE"/> 
</input> 
<output> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="ADRESSE_WEBSERVICE"/> 
</output> 
</operation> 
</binding> 
<service name="BoWSService"> 
<port name="BoWSPort" binding="tns:BoWSBinding"> 
<soap:address location="ADRESSE_WEBSERVICE"/> 
</port> 
</service> 
<message name="writeArrayIn"> 
<part name="array" type="soap-enc:Array"/> 
</message> 
<message name="writeArrayOut"> 
<part name="return" type="xsd:int"/> 
</message> 
</definitions> 

私はこのようにあるsoapUIを経由して、それをテストしたときに機能が正常に動作します。私はその機能に多次元なを送信する必要が

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="ADRESSE_WEBSERVICE"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <wsdl:writeArray soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
     <SOAP-ENC:Array SOAP-ENC:arrayType="xsd:string[][3]"> 
    <SOAP-ENC:Array id="array-1" SOAP-ENC:arrayType="xsd:string[4]"> 
    <item>26</item> 
    <item>223</item> 
    <item>test</item> 
    <item>test3</item> 
    </SOAP-ENC:Array> 
    <SOAP-ENC:Array id="array-2" SOAP-ENC:arrayType="xsd:string[4]"> 
    <item>26</item> 
    <item>750</item> 
    <item>test</item> 
    <item>test4</item> 
    </SOAP-ENC:Array> 
    <SOAP-ENC:Array id="array-3" SOAP-ENC:arrayType="xsd:string[4]"> 
    <item>70</item> 
    <item>360</item> 
    <item>tes321</item> 
    <item>test23</item> 
    </SOAP-ENC:Array> 
</SOAP-ENC:Array> 
     </wsdl:writeArray> 
    </soapenv:Body> 
</soapenv:Envelope> 

C++プログラムからの文字列の配列/ベクトル。

私はgSoapヘッダーと関数をwsdl2hで生成しました。

その関数の配列パラメータはsoapStub.hファイルに生成構造です:

struct _Struct_3 
{ 
public: 
    char **__ptr; 
    int __size; 
}; 

私の問題は、私が多次元な配列としてその構造を使用する方法がわからないです。

vector< vector<string> > testArray 

私は簡単に文字列配列の配列として変換することができます:私は挿入する必要が

配列が起源で、文字列ベクトルのベクトルです。

+0

あなたはSTLを使用するには、スイッチとのgSOAPコードを生成しようとしました:

wsdl2hを実行した後に生成された.hファイルでこの宣言を変更しますか? (私が正しく覚えていれば、生成されたコードでstlを有効または無効にするオプションがありました) – utnapistim

答えて

0

このWSDLの問題点は、配列とその要素の型情報がないことです。一般的な「soap-enc:Array」への参照にすぎません。

struct _Struct_3 
{ 
    std::string *__ptr; 
    int __size[2]; // 2D array 
}; 
+0

あなたの応答に感謝します。最後に、2Dベクトルの各要素を抽出し、char ** __ptrに入力します。私はvector [i] * vector [j]サイズで__sizeを塗りつぶし、正しく動作します。 – niusha

関連する問題