Tom, some comments below

Regards

Simon

On Nov 22, 2007 9:08 AM, Tom <[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.

>
>
> By doing this we plan to add support for JSON return data. We'd be
> glad to contribute this extension to the CVS once it's finished.

Sounds good to me. There is code in the jsonrpc binding for the conversion
into JSON. In SCA_ServiceWrapperJson.php you'll find

            // convert the reponse from the message call into something
            // that can be copied  into a JSON result string by the
            // JSON Server
            if ( $return == null ) {
                $response_object = "null";
            } else if ( is_object($return) ) {
                $response_object = $this->json_das->encode($return);
            } else if ( is_array($return) ) {
                throw new SCA_RuntimeException("Return from method
$method_name of type array found. " .
                "Return types must be either primitives or SDOs");
            } else {
                $response_object = json_encode($return);
            }
Which checks the response type and does the appropriate conversion.

The json das must be set up based on the the schema that describes the types
in the service interface if you are expecting json to be passed into the
service. In your case you are only talking about encoding return types so
you can get away without doing this I think. If you look at the constructor
for the SCA_ServiceWrapperJson you can see the das being created.

Would be great to have this contributed back into CVS so thanks for the
offer.

>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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