Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:56:31+00:00 2026-06-04T10:56:31+00:00

I am trying to call a Restful WS from GWT using JSOPRequestBuilder. I have

  • 0

I am trying to call a Restful WS from GWT using JSOPRequestBuilder. I have a similar issue which was reported in the link

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/ef93383aca7a3dfc/d4dc5bad1a9110ea

But, I could not figure out the solution. Kindly help me at the earliest.

My JAX-WS resource code snippet from server

 @GET
   @Produces(MediaType.APPLICATION_JSON)
   public DealerAddress getDealerAddress(@QueryParam("dealerId") String sDealerId) {

       DealerAddress dlrAd = new DealerAddress("test", "test", "test", "test", 10, new Date(), new Date());
       return dlrAd;
   }

Jersey returns a JSON object of DealerAddress.

Now rest URL “https://127.0.0.1:8181/application/rest/OrderManagementResource?alt=json-in-script&dealerId=DLR1”
works absolutely fine when i tried request in browser.

It even works with RequestBuilder approach from GWT but not with JSONPRequestBuilder approach.

Code snippet to invoke WS from GWT using JSONPRequestBuilder

JsonpRequestBuilder jsonPReqBuilder = new JsonpRequestBuilder();        
jsonPReqBuilder.setTimeout(100000);
        jsonPReqBuilder.setCallbackParam("callback");
        jsonPReqBuilder.requestObject("https://127.0.0.1:8181/application/rest/OrderManagementResource?alt=json-in-script&dealerId=DLR1" , new       AsyncCallback<DealerAddressJSON>() {

            @Override
            public void onFailure(Throwable caught) {
                // TODO Auto-generated method stub
                caught.printStackTrace();
                Window.alert("Inside error"+caught.getLocalizedMessage());          
            }

            @Override
            public void onSuccess(DealerAddressJSON result) {
                // TODO Auto-generated method stub
                Window.alert("Inside success"+result);
            }

        });

where as DealerAddressJSON is a JavaScriptObject type class.

I could see that my JAX Rest resource getting called and saying returning from server.

Also, I could see that in Firebug that the response comes in browser but fails with an exception “Unknown token :”
At the end I always get a Timeout exception.
Now I am in big question whether the way we return JSON from JAX-RS resource is a problem in server
or
JSONPRequestBuilder calling procedure is a problem? I could not understand the callback changes which some of the links explained on this issue.

Kindly help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:56:33+00:00Added an answer on June 4, 2026 at 10:56 am

    You are probably sending back JSON, while the JSONPRequestBuilder expects JSONP. These are not the same thing.

    JSON is just the data, as is – make the request using AJAX (i.e. the RequestBuilder), and the contents can be read directly. These requests can only be made to the same server. Example JSON data:

    {"response":"success", "items":[{"id":1}, {"id":2}]}
    

    In contrast, JSONP is designed for cross-origin requests, so instead of just containing the data, the data is wrapped up in a JavaScript. Since your JSON service isn’t wrapping the a response in a js function call, this isn’t working. Example JSONP data:

    callback_1({"response":"success", "items":[{"id":1}, {"id":2}]})
    

    The callback changes with each request, so the server is supposed to change that callback function based on what the client requested each time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call a WCF RESTful service from jQuery. I am using
I'm trying to call a RESTful web service from an Android application using the
I'm trying to make a RESTful api call from the android emulator (using android
I'm trying to call a stored procedure from my .NET code which has one
I am trying to call a web service from asp.net 3.5 application. I have
I'm trying to do an ajax (restful service) call using $.get. It works perfectly
Trying to call from an android client, using the signpost oauth libs. I generated
I'm trying to parse the result from a RESTFull call using RestTemplate following this
I'm trying to call a Restful service from a Silverlight 4 Out of browser
Trying to call a SAP SOAP Web Service from a generated sudzc app shows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.