Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP / NuSOAP array encoding

    Hello,

    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"
    SOAP-ENC:arrayType="SOAP-ENC:Array[6,6]">
    <item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:ur-type[2]">
    <item xsi:type="xsd:string">1010T</item><item
    xsi:type="xsd:int">1</item></item>
    <item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:ur-type[2]">
    <item xsi:type="xsd:string">4010T</item><item
    xsi:type="xsd:int">1</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>
    </autoparts>

    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>
    </SubArray1>
    <SubArray2 xsi:type="enc:Array" enc:arrayType="xs:anyType[2]">
    <i1 xsi:type="xs:string">4010T</i1>
    <i2 xsi:type="xs:int">1</i2>
    </SubArray2>
    <SubArray3 xsi:type="enc:Array" enc:arrayType="xs:anyType[2]">
    <i1 xsi:type="xs:string">1</i1>
    <i2 xsi:type="xs:int">1</i2>
    </SubArray3>
    </autoparts>

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

    Thanks,

    Salar Madadi
    - Latest Developments Inc.

  • #2
    New Coder
    Join Date
    Sep 2007
    Location
    Hanoi, Vietnam
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you simply use SOAP with standard type (string)..
    For example, use NUSOAP you can use the client function:
    PHP Code:
    $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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •