On 22 Nov, 12:57, Tom <[EMAIL PROTECTED]> wrote:
> Simon,
>
> Great thing you like the idea. Some new thoughts below.
>
> On 22 Nov, 11:50, "Simon Laws" <[EMAIL PROTECTED]> wrote:
>
> > > Currently the restrpc binding will only return data in XML format.
> > > Unless anyone has a better suggestion we will be extending our
> > > installation of phosoa to check the Accept header of the client to
> > > determine the format of return data.
> > Sounds like a good idea to me. There is the opportunity in
> > restrpc/Server.php to convert the response into the required output format
> > so I think this will work.
>
> Using only the header turns out to be impractical when calling
> the API from a browser based script when not using the XMLHTTPRequest
> object, since it's then not possible to modify the request header in
> any way.
>
> My suggestion is to, instead of looking at the accept header, or as an
> override possibility, add an optional parameter after the method name:
>
> That would make these calls valid:
> /MyService.php/myMethod/json?a=b&c=a returns JSON
> /MyService.php/myMethod/xml?a=b&c=a returns XML
> /MyService.php/myMethod?a=b&c=a returns XML for backwards
> compatibility
>
> Regards
>
> /Tom

Hi Tom

If you can't manipulate the accept headers can you use the JSONRPC
binding which will return JSON formatted messges? Looking at the code
it seems that the JSONRPC binding will only handle POST requests in
JSON format at the moment. There is a TODO about parsing GETs but  the
code from the RESTRPC binding could be used here to get the effect I
think you are after. I.e. HTTP params in, JSON out.

If that isn't a viable alternative then I don't have a particular
objection to adding the path info. I'd like to understand a little
more about the problem setting accept headers though as that sounded
like a neater solution. What mechanism are you using for making the
calls from the browser?

Regards

Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to