Magento V2 APIを拡張したため、wsdl.xmlを作成しました。私のWebサービスは連想マルチ配列を返します。私は少しグーグルして、複雑なタイプの2つの定義を見つけました:
<complexType name="associativeMultiArray">
<all>
<element name="associativeArray" type="typens:associativeArray" minOccurs="0" />
</all>
</complexType>
<complexType name="stringArray">
<all>
<element name="multi_data" type="typens:associativeMultiArray" minOccurs="0" />
</all>
</complexType>
<message name="methodResponse">
<part name="result" type="typens:stringArray" />
</message>
別のもの:
<complexType name="associativeMultiArray">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:associativeMultiEntity[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="associativeMultiEntity">
<all>
<element name="key" type="xsd:string"/>
<element name="value" type="typens:ArrayOfString"/>
</all>
</complexType>
<complexType name="ArrayOfString">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
<message name="methodResponse">
<part name="result" type="typens:associativeMultiArray" />
</message>
問題は、これら2つの機能のいずれも機能しないことです。クエリの後に結果を出力すると、次のようになります。
Array
(
[0] => stdClass Object
(
)
)
array('test)
戻るかどうかは関係ありませんarray('key'=>'value')
。常に同じ出力です。基本的に私は2つの質問があります:
ArrayOfString
、associativeArray
および次associativeMultiArray
の宣言:?<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>
- 10次元の連想配列のような非常に複雑な配列構造がある場合、wsdl.xmlですべての次元を宣言する必要がありますか?これをどのように処理しますか?それはどのように機能しますか?上記の宣言が機能しないのはなぜですか?