Friday, January 20, 2012

Truncated JSON problem using RequestBuilder with WCF rest service

Using GWT 2.1, I have a WCF web service with a simple interface and I
am trying to call it using RequestBuilder as follows:

String url = "http://localhost/EmployeeService/Service1.svc/web/
GetEmployees";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
URL.encode(url));

try {
builder.sendRequest(null, new RequestCallback(){

@Override
public void onResponseReceived(Request request, Response
response) {
if(200 == response.getStatusCode()){
GWT.log(response.getText());
}
}

@Override
public void onError(Request request, Throwable exception)
{
System.out.println("error=" + exception.getMessage());
}

});
}catch(Exception e){
e.printStackTrace();
}

The service returns the following JSON and I have verified that in
Firebug as well as Fidler:

[
{
"Addresses":[
{
"Line1":"22 High Street",
"Line2":"Bookham"
}],

"Id":2,
"Name":"JHGFFF"
},
{
"Addresses":[
{
"Line1":"59 Low Street",
"Line2":"Leatherhead"
},
{
"Line1":"33 No Entry Road",
"Line2":"Fetchem"
}],

"Id":10,
"Name":"Done It"
}
]

However when I look at the response.getText() it truncates the JSON to
the following:

[{"Id":2,"Name":"JHGFFF"},{"Id":10,"Name":"Done It"}]

Very weired ??

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment