CodeIgniter Forums

Full Version: xml rpc request/repsonse formatting questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hi folks!

I've been tasked with writing an api for a new payment gateway my company is using. We've got many apps on our end that will need to run payments thru the system, so I'm planning to write the interface to the gateway as an xml_rpc server.

I keep running into issues regarding how to 'best' format the requests and the responses.

I'd like the requesting client to be able to specify the method they want to use from the server, and send an xml string that contains all the information that is needed to be processed.

The rpc server would then based on the method requested forward that information to the payment processor, and generate a response that contains the xml result from the processor.

The big question is, can raw xml be included in the request/response format? If not, can it be escaped or enclosed in CDATA tags or something of that ilk?

Looking for some guidance here, I've tried a ton of different array combinations for the data and I'm starting to wonder if this is even possible using xml in the request/response.

Thanks in advance for any help!

El Forum

[eluser]socs[/eluser]
I also have a requirement to enclose some of the xml rpc data in CDATA tags,
but looks like the CI Xmlrpc library doesn't support it.

Looking thru the the ParseResponse function in Xmlrpc.php to see what's the best way to support it.

El Forum

[eluser]Unknown[/eluser]
I think I've got a workaround.

I've had some success with serializing the xml I want to return, and then base64 encoding it. Makes for a much simplier response array with only one return element.

Then all you have to do is reverse the process on your client side, and presto!