SOAP complex type arguments

From: Date: Thu, 10 Nov 2005 19:51:20 +0000
Subject: SOAP complex type arguments
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21879@lists.php.net to get a copy of this message
I'm having trouble using the PEAR SOAP module (0.9.1) to call a remote JBoss servlet. It uses the rpc/encoded document style. To start, I'm trying to call a function that takes a single Map argument. The map can include an unbounded number of mapItems, like so: <complexType name="mapItem"> <sequence> <element name="key" nillable="true" type="xsd:string"/> <element name="value" nillable="true" type="xsd:string"/> </sequence> </complexType> <complexType name="Map"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/> </sequence> </complexType> This code gets me pretty close: $args = array( array('key' => 'foo', 'value' => 'bar'), array('key' => 'foo2', 'value' => 'bar2'), ); $wsdl = new SOAP_WSDL('http://remote/endpoint'); $client = $wsdl->getProxy(); $result = $client->accountModified($args); with this output: <ns4:accountModified> <in0 xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="Struct[13]" SOAP-ENC:offset="[0]"> <item> <key xsi:type="xsd:string">foo</key> <value xsi:type="xsd:string">bar</value></item> <item> <key xsi:type="xsd:string">foo2</key> <value xsi:type="xsd:string">bar2</value></item> </in0></ns4:accountModified> The only problem is that in0 is an array of Structs instead of a Map. I tried putting $args into a SOAP_Value of that type: $args = new SOAP_Value(null, '{http://xml.apache.org/xml-soap}Map', $args); but that wraps the arguments in an <item> of Structs: <ns5:accountModified> <in0 xsi:type="ns4:Map"> <item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="Struct[13]" SOAP-ENC:offset="[0]"> <item> <key xsi:type="xsd:string">foo</key> <value xsi:type="xsd:string">bar</value></item> <item> <key xsi:type="xsd:string">foo2</key> <value xsi:type="xsd:string">bar2</value></item> </item></in0></ns5:accountModified> What I'm looking for is: <ns4:accountModified> <in0 xsi:type="{http://xml.apache.org/xml-soap}Map"> <item> <key xsi:type="xsd:string">foo</key> <value xsi:type="xsd:string">bar</value></item> <item> <key xsi:type="xsd:string">foo2</key> <value xsi:type="xsd:string">bar2</value></item> </in0></ns4:accountModified> What am I missing? thanks, john -- John Morrissey _o /\ ---- __o jwm@horde.net _-< \_ / \ ---- < \, www.horde.net/ __(_)/_(_)________/ \_______(_) /_(_)__

« previous php.pear.general (#21879) next »