Pear SOAP - sending an array of complex types
| From: | (PHPDiscuss - PHP Newsgroups and mailing lists) | Date: | Fri, 25 Jun 2004 23:13:56 +0000 |
| Subject: | Pear SOAP - sending an array of complex types | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1556@lists.php.net to get a copy of this message | ||
Hi all,
I am trying to send an array of complex types to a mapping application
using PHP4 and the Pear::SOAP package.
Here is a part of the message I am sending:
<pre>
<routeStops xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="Struct[2]"
SOAP-ENC:offset="[0]">
<item>
<point>
<x xsi:type="xsd:float">-123.335816</x>
<y xsi:type="xsd:float">48.420692</y>
<coordinateSystem>
<projection xsi:type="xsd:string">4326</projection>
</coordinateSystem>
</point>
</item>
<item>
<point>
<x xsi:type="xsd:float">-123.392048</x>
<y xsi:type="xsd:float">48.483424</y>
<coordinateSystem>
<projection xsi:type="xsd:string">4326</projection>
</coordinateSystem>
</point>
</item>
</routeStops>
</pre>
Here is what I would like to be sending:
<pre>
<routeStops xsi:type="soapenc:Array"
soapenc:arrayType="ns13:RouteStop[2]">
<item>
<point>
<x xsi:type="xs:double">-123.335816</x>
<y xsi:type="xs:double">48.420692</y>
<coordinateSystem>
<projection xsi:type="xs:string">4326</projection>
<datumTransformation xsi:type="xs:string"></datumTransformation>
</coordinateSystem>
</point>
</item>
<item>
<description xsi:type="xs:string">test</description>
<point>
<x xsi:type="xs:double">-123.392048</x>
<y xsi:type="xs:double">48.483424</y>
<coordinateSystem>
<projection xsi:type="xs:string">4326</projection>
<datumTransformation xsi:type="xs:string"></datumTransformation>
</coordinateSystem>
</point>
</item>
</routeStops>
</pre>
Here is part of the code used to construct the outgoing payload:
$routeStops[0]->point->x = -123.335816;
$routeStops[0]->point->y = 48.420692;
$routeStops[0]->point->coordinateSystem->projection = "4326";
$routeStops[1]->point->x = -123.392048;
$routeStops[1]->point->y = 48.483424;
$routeStops[1]->point->coordinateSystem->projection = "4326";
$routeStops = new SOAP_Value("routeStops", "{urn}RouteStop", $routeStops);
I am trying to get the outbound payload to be an array of type RouteStop,
but it's being sent as an array of type Struct.
This is happening in Base.php's _getType() method.
I am pretty sure that this is because I'm misusing new SOAP_Value(), but
no matter what I provide as the second parameter to SOAP_Value's
constructor, it doesn't seem to take.
Any pointers would be appreciated.
Greg Froh
http://greg.froh.ca