Welcome Guest, Not a member yet? Register   Sign In
Responses for XML-RPC API
#1

[eluser]Jeremy Gimbel - Conflux Group[/eluser]
I'm trying to build an XML-RPC server that allows me to pull in data from an existing invoice application into a separate application, which will handle payments.

As you can imagine the structure of the invoice needs to be nested, to incorporate multiple line items.

I've mapped out how I'd like the array of data to look when it is received on the client end.

Code:
Array
(
    [id] => IN000012
    [date] => 12/24/2008
    [customer] => Array
            (
                [personal_name] => John Smith
                [company_name] => Conflux Group
                [address_1]    => 123 Main Street
                [address_2] => Suite 200
                [address_3] =>
                [city] => New York
                [state] => NY
                [zip] => 10108
                [telephone] => 212.555.1212
                [e-mail] => [email protected]
    
            )
    [po] =>
    [terms] => NET 30
    [due_date] => 01/31/2009
    [subtotal] => 100.00
    [tax] => 6.00
    [paid] => 0.00
    [amount_due] => 106.00
    [line_items] => Array
            (
                [0] = Array
                        (
                            [quantity] => 1    
                            [description] => Item Description
                            [price]    => 1.00
                            [total] => 1.00

                        )
    
            )
    
)

I am currently able to get data to go back and forth, but I am getting bogged down trying to get the array into a proper response format, where the data type is specified in an array with the data. It seems that I'll need a never-ending number of nested arrays to accomplish this.

Am I missing something?

Could someone post a code sample that might clarify how I can get this kind of array into a response?

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB