View Full Version : PHP / NuSOAP array encoding

07-15-2008, 11:05 PM

We are working on interfacing a website that uses PHP with the NuSOAP
library to an application using xBase with the xb2.net library to transmit
an array from the site to the application.

The test array I am trying to transmit is below:
{"1010T", 1},
{"4010T", 1},
{"1", 1}

If I create the array in PHP and transmit it via SOAP to the application
using NuSOAP to send and xb2.net to receive, the array is encoded like so:

<autoparts xsi:type="SOAP-ENC:Array"
<item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:ur-type[2]">
<item xsi:type="xsd:string">1010T</item><item
<item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:ur-type[2]">
<item xsi:type="xsd:string">4010T</item><item
<item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:ur-type[2]">
<item xsi:type="xsd:string">1</item><item xsi:type="xsd:int">1</item></item>

When received in xb2.net it comes out as an array (detected by VALTYPE) but
a LEN call on the array returns 0.

If I create the same array using xb2.net and output it using the :asstring()
method, the array is encoded like this:

<autoparts xsi:type="enc:Array" enc:arrayType="xs:anyType[3]">
<SubArray1 xsi:type="enc:Array" enc:arrayType="xs:anyType[2]">
<i1 xsi:type="xs:string">1010T</i1>
<i2 xsi:type="xs:int">1</i2>
<SubArray2 xsi:type="enc:Array" enc:arrayType="xs:anyType[2]">
<i1 xsi:type="xs:string">4010T</i1>
<i2 xsi:type="xs:int">1</i2>
<SubArray3 xsi:type="enc:Array" enc:arrayType="xs:anyType[2]">
<i1 xsi:type="xs:string">1</i1>
<i2 xsi:type="xs:int">1</i2>

How can I standardize one side or the other when transmitting arrays like


Salar Madadi
- Latest Developments Inc.

07-17-2008, 11:59 AM
Can you simply use SOAP with standard type (string)..
For example, use NUSOAP you can use the client function:

$params = array ();

$client->call ("function", $params);

Or you can use php serialize function, or use JSON instead ? There are so many solutions to parse a variable