Hello.
> I want to tie the GWT to the php server and make the php scripts return
> JSON.
That's what I do for a medium project I work on, and it works nicely.
The whole interface is in GWT, and server only sends JSON, with a few
exceptions.
One important point to take care of, with JSON coming from PHP, is the
values's type, not intuitive when working with PHP which converts implicitely.
If you have a class MyClass extending JavaScriptObject, that you get through a
simple conversion of the received JSON using eg
public static native T fromJson(String json, Class
name) /*-{
return eval(json);
}-*/;
and this class uses native properties like:
public final native int getId() /*-{ return this.id; }-*/;
then you must ensure the PHP code correctly converts data to int before
calling json_encode.
If you do eg
$json['id'] = $database_row['id'];
then PHP will write a string for the property, and some browsers (Chrome in
particuler) will complain and report an exception.
You have to explicitely use
$json['id'] = intval($database_row['id'];
This also applies to boolean types, for which you need to use PHP's
true/false, and not 0/1 or any other thing.
Apart that, you should be ok :)
> It would be really useful to have the GWT make SOAP calls to
> the SOAP server. Is this possible?
Should be possible, as you can generate and read XML with GWT, and unless I'm
mistaking that's what SOAP uses. Not sure if there are wrappers to simplify
reading/writing, though.
Hope this helps
Nicolas
signature.asc
Description: This is a digitally signed message part.