Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem in reading from REST datasource

    1. I am testing out REST datasource using evaluation copy of smartgwtee5.0p. I insert a REST datasource in the sample project, buildinds. The file is country.ds.xml, reproduced below:-

    <DataSource
    ID="country"
    dataFormat="JSON"
    dataTransport="XMLHTTPREQUEST"
    useStrictJSON="true"
    dataURL="http://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch2"
    recordName="country"
    recordXPath="/response/ds/ds/country"
    >
    <fields>
    <field name="countryCode" title="Code" type="text" primaryKey="true" required="true"/>
    <field name="countryName" title="Name" type="text" />
    <field name="continent" title="Continent" type="text"/>
    </fields>
    </DataSource>

    2. When the fetch data is performed on this source, I got error: HTTP/1.1 405 Method Not Allowed. The following is log from eclipse:-

    == 2015-03-07 17:03:07,087 [1-28] DEBUG PoolableDataSourceFactory - Activated DataSource 22 of type 'Object'
    === 2015-03-07 17:03:07,088 [1-28] DEBUG HttpProxyServlet - HttpProxy - ProxyData is: {
    xsi:"http://www.w3.org/2000/10/XMLSchema-instance",
    url:"http://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch2",
    httpMethod:"GET",
    params:{
    },
    requestBody:"",
    callbackParam:""
    }
    === 2015-03-07 17:03:07,225 [1-28] WARN HttpProxyServlet - HttpProxy - Method failed: HTTP/1.1 405 Method Not Allowed
    === 2015-03-07 17:03:07,226 [1-28] INFO HttpProxyServlet - HttpProxy - Response:

    [WARN] 405 - POST /builtinds/sc/HttpProxy (127.0.0.1)
    Request headers
    Accept: */*
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    Referer: http://127.0.0.1:8888/BuiltInDS.html?gwt.codesvr=127.0.0.1:9997
    Accept-Language: en-GB,en;q=0.8,zh-Hant-HK;q=0.5,zh-Hant;q=0.3
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
    Host: 127.0.0.1:8888
    Content-Length: 420
    DNT: 1
    Connection: keep-alive
    Cache-Control: no-cache
    Cookie: JSESSIONID=1757lmgjymb7a1kromcch6v6zl; isc_cState=ready; GLog=%7B%0D%20%20%20%20trackRPC%3Afalse%0D%7D
    Response headers
    X-Included-Test2: true
    X-Included-Test: true
    X-Proxied-Set-Cookie: JSESSIONID=7B1AA6D1D32A2ACB60167A631F0A9304; Path=/RESTTEST/; HttpOnly
    Content-Length: 0

    3. I use the same REST server with smartgwt RESTDataSource example, and it works there. The following is the eclipse console log when it works as a RESTDataSource:-

    === 2015-03-07 17:31:06,123 [4-28] DEBUG PoolableDataSourceFactory - Created DataSource 2 of type 'Object' and assigned it to thread qtp1940532364-28
    === 2015-03-07 17:31:06,123 [4-28] DEBUG PoolableDataSourceFactory - Created DataSource 2 of type 'Object' in the pooling flow
    === 2015-03-07 17:31:06,123 [4-28] DEBUG PoolableDataSourceFactory - Activated DataSource 2 of type 'Object'
    === 2015-03-07 17:31:06,131 [4-28] DEBUG HttpProxyServlet - HttpProxy - ProxyData is: {
    xsi:"http://www.w3.org/2000/10/XMLSchema-instance",
    url:"http://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch2",
    httpMethod:"POST",
    params:{
    isc_dataFormat:"json"
    },
    contentType:"application/json",
    requestBody:"{\r \"dataSource\":\"isc_RestfulDataSourceSample_1_0\", \r \"operationType\":\"fetch\", \r \"startRow\":0, \r \"endRow\":50, \r \"sortBy\":[\r \"countryCode\"\r ], \r \"textMatchStyle\":\"substring\", \r \"componentId\":\"isc_ListGrid_0\", \r \"data\":{\r }, \r \"oldValues\":null\r}",
    callbackParam:""
    }
    === 2015-03-07 17:31:06,264 [4-28] INFO HttpProxyServlet - HttpProxy - Method succeeded: HTTP/1.1 200 OK
    === 2015-03-07 17:31:06,265 [4-28] INFO HttpProxyServlet - HttpProxy - Response:
    {"response":{"ds":{"ds":{"country":[{"countryCode":"CN","countryName":"China","continent":"AS"}]}}}}
    === 2015-03-07 17:31:06,266 [4-28] INFO Compression - /customds/sc/HttpProxy: 100 -> 88 bytes


    4. I suspect that the problem is with the content-type specification when accessing it via ds.xml

    [WARN] 405 - POST /builtinds/sc/HttpProxy (127.0.0.1)
    Request headers
    Accept: */*
    Content-Type: application/x-www-form-urlencoded;

    The content-type of x-www-form-urlencoded is not recognised by my REST server. I can confirm this using POSTMAN in Google.



    When the call is successful via RESTDataSource, the contenttype is "application/json".

    5. Is there a way to specify content-type with ds.xml? or you think the problem is somewhere else.

    Thanks very much for your help

    #2
    You can modify the contentType by calling the setContentType() method on your DSRequest (method inherited from RPCRequest).

    Do do this you'd need a RequestTransformer on your DataSource. You can apply this to the DS at runtime (even if your DS was defined using XML) by calling the appropriate signature of DataSource.getDataSource() and passing your transformer in

    Comment


      #3
      Dear Administrator,
      I did as you suggested. However, the error remains the same.
      The following is the section of code where I set RequestTransformer to datasource.

      Code:
         private void bindComponents(String dsName) {
          	DataSource ds;
          	if ( dsName.equals("country")) {
          		 // ds = DataSource.get(dsName);
          
          		  ds = DataSource.getDataSource(dsName,  new RequestTransformer(){
      
      				@Override
      				protected Object transformRequest(DSRequest dsRequest) {
      					System.out.println("before transform : content-type=" + dsRequest.getContentType());
      					// TODO Auto-generated method stub
      				System.out.println("request=" + dsRequest.toString());
      					dsRequest.setContentType("application/json");
      					System.out.println("after transform : content-type=" + dsRequest.getContentType());
      					return getDefaultTransformRequest(dsRequest);
      				}
          			  
          		  }, 
          		  new ResponseTransformer() {
      
      				@Override
      				protected void transformResponse(DSResponse response,
      						DSRequest request, Object data) {
      					// TODO Auto-generated method stub
      					
      				}
          			  
          		  }
          		  )
          		;
          	}
          	else {
              
               ds = DataSource.get(dsName);
              
          	}
              //ds.setDataFormat(DSDataFormat.JSON);
              boundList.setDataSource(ds);
              boundViewer.setDataSource(ds);
              boundForm.setDataSource(ds);
      The following is the log in the console:-

      Code:
      === 2015-03-23 20:25:47,780 [9-28] INFO  Download - Returning 304: Not modified on conditional get of: Y:\eclipse-jee-indigo-SR2-win32-x86_64\workspace4\builtinds\war\builtinds\sc\skins\Enterprise\images\Scrollbar\vscroll_sprite.png
      before transform : content-type=null
      request=com.smartgwt.client.data.DSRequest@1
      after transform : content-type=application/json
      === 2015-03-23 20:27:44,560 [9-28] INFO  RequestContext - URL: '/builtinds/sc/HttpProxy', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko': Unsupported with Accept-Encoding header
      === 2015-03-23 20:27:44,567 [9-28] INFO  HttpProxyServlet - HttpProxy - No rules defined - proxying all incoming URLs.
      === 2015-03-23 20:27:44,570 [9-28] DEBUG XML - Parsed XML from (in memory stream): 1ms
      === 2015-03-23 20:27:44,570 [9-28] DEBUG ISCKeyedObjectPool - Borrowing object for 'data'
      === 2015-03-23 20:27:44,571 [9-28] DEBUG PoolableDataSourceFactory - Created DataSource null of type 'data' in the pooling flow
      === 2015-03-23 20:27:44,571 [9-28] DEBUG ISCKeyedObjectPool - Borrowing object for 'Object'
      === 2015-03-23 20:27:44,571 [9-28] DEBUG PoolableDataSourceFactory - Created DataSource 22 of type 'Object' and assigned it to thread qtp492422619-28
      === 2015-03-23 20:27:44,571 [9-28] DEBUG PoolableDataSourceFactory - Created DataSource 22 of type 'Object' in the pooling flow
      === 2015-03-23 20:27:44,571 [9-28] DEBUG PoolableDataSourceFactory - Activated DataSource 22 of type 'Object'
      === 2015-03-23 20:27:44,572 [9-28] DEBUG HttpProxyServlet - HttpProxy - ProxyData is: {
          xsi:"http://www.w3.org/2000/10/XMLSchema-instance",
          url:"http://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch2",
          httpMethod:"GET",
          params:{
          },
          contentType:"application/json",
          requestBody:"",
          callbackParam:""
      }
      === 2015-03-23 20:27:44,589 [9-27] INFO  Download - Returning 304: Not modified on conditional get of: Y:\eclipse-jee-indigo-SR2-win32-x86_64\workspace4\builtinds\war\builtinds\sc\skins\Enterprise\images\loadingSmall.gif
      === 2015-03-23 20:27:44,774 [9-28] WARN  HttpProxyServlet - HttpProxy - Method failed: HTTP/1.1 405 Method Not Allowed
      === 2015-03-23 20:27:44,775 [9-28] INFO  HttpProxyServlet - HttpProxy - Response:
      
      [WARN] 405 - POST /builtinds/sc/HttpProxy (127.0.0.1)
         Request headers
            Accept: */*
            Content-Type: application/x-www-form-urlencoded; charset=UTF-8
            Referer: http://127.0.0.1:8888/BuiltInDS.html?gwt.codesvr=127.0.0.1:9997
            Accept-Language: en-GB,en;q=0.8,zh-Hant-HK;q=0.5,zh-Hant;q=0.3
            Accept-Encoding: gzip, deflate
            User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
            Host: 127.0.0.1:8888
            Content-Length: 475
            DNT: 1
            Connection: keep-alive
            Cache-Control: no-cache
            Cookie: GLog=%7B%0D%20%20%20%20trackRPC%3Afalse%0D%7D; JSESSIONID=1qbsgpbu8bc021vufv5x4ixd4t; isc_cState=ready
         Response headers
            X-Included-Test2: true
            X-Included-Test: true
            X-Proxied-Set-Cookie: JSESSIONID=E967A671E89BFD5AC2B00FD7650BA92A; Path=/RESTTEST/; HttpOnly
            Content-Length: 0
      The following is the log in Development Console

      Code:
      20:27:44.795 [ERROR] [builtinds] 20:27:44.795:TMR0:WARN:ResultSet:isc_ResultSet_0 (dataSource: country, created by: isc_ListGrid_1):Bad data returned, ignoring: "Transport error - HTTP code: 405 for URL: http://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch2 (via proxy: http://127.0.0.1:8888/builtinds/sc/HttpProxy)"
      com.smartgwt.client.core.JsObject$SGWT_WARN: 20:27:44.795:TMR0:WARN:ResultSet:isc_ResultSet_0 (dataSource: country, created by: isc_ListGrid_1):Bad data returned, ignoring: "Transport error - HTTP code: 405 for URL: http://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch2 (via proxy: http://127.0.0.1:8888/builtinds/sc/HttpProxy)"
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
          at java.lang.reflect.Constructor.newInstance(Unknown Source)
          at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
          at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
          at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
          at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
          at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
          at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
          at java.lang.Thread.run(Unknown Source)

      Please help with more suggestions.

      Thanks
      Kay Chee

      Comment


        #4
        The request that does not have application/json as it's contentType is a request to the HttpProxy servlet, not to your REST endpoint.

        Most likely you are not intending to use the HttpProxy servlet at all - see the docs for rpcRequest.useHttpProxy to understand why it would be used automatically and how to avoid it.

        Comment


          #5
          I set rpcRequest.useHttyProxy to false. I do not get the HttpProxy error any more.

          I also need to remove the line dataTransport="XMLHTTPREQUEST" from my ds.xml file. Otherwise, I got unsupported dataTransport error.

          I now has error when fetchData() is executed.

          My source

          Code:
           private void bindComponents(String dsName) {
              	DataSource ds;
              	if ( dsName.equals("country")) {
              		 // ds = DataSource.get(dsName);
              		  ds = DataSource.getDataSource(dsName,  new RequestTransformer(){
          
          				@Override
          				protected Object transformRequest(DSRequest dsRequest) {
          					System.out.println("before transform : content-type=" + dsRequest.getContentType());
          					// TODO Auto-generated method stub
          				    System.out.println("request=" + dsRequest.toString());
          					dsRequest.setContentType("application/json");
          					dsRequest.setUseHttpProxy(false);
          					System.out.println("after transform : content-type=" + dsRequest.getContentType());
          					return getDefaultTransformRequest(dsRequest);
          				}
              		  }, 
              		  new ResponseTransformer() {
          				@Override
          				protected void transformResponse(DSResponse response,
          						DSRequest request, Object data) {
          					// TODO Auto-generated method stub
          				}
              		  }
              		  )
              		;
              	}
              	else {
                   ds = DataSource.get(dsName);
                  }
                  //ds.setDataFormat(DSDataFormat.JSON);
              	System.out.println("pass0");
                  boundList.setDataSource(ds);
                  
                  System.out.println("pass1");
                  boundViewer.setDataSource(ds);
                  
                  System.out.println("pass2");
                  boundForm.setDataSource(ds);
                  
                  System.out.println("pass3");
                  boundList.fetchData();
                  
                  System.out.println("pass4");
                  newBtn.enable();
                  saveBtn.disable();
              }
          }
          The eclipse console log is as follows.

          Code:
          pass0
          pass1
          pass2
          pass3
          before transform : content-type=null
          request=com.smartgwt.client.data.DSRequest@1
          after transform : content-type=application/json
          There is no errror in Development Mode window.

          But this error from Web Page:-
          Code:
          Message from webpage
          
          Uncaught exception escaped:
          com.google.gwt.event.shared.UmbrellaException
          Exception caught:(Error)
          @com.smartgwt.client.widgets.grid.ListFrid::fetchData([]):Permission denied
          See the GWT exception log for details.
          Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling
          The error is about Permission denied. Please suggest what I can do next.

          Thanks and regards
          Kay Chee

          Comment


            #6
            Make your dataURL into a relative URL. It should not start with "http", even if you are accessing localhost. Otherwise, the browser will think you are making a cross-site call, and disallow it (as you've seen here).

            Comment


              #7
              I changed my dataURL to "://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch3"

              The permission denied error is gone. Now I have the 404 error in console

              Code:
              pass0
              pass1
              pass2
              pass3
              before transform : content-type=null
              request=com.smartgwt.client.data.DSRequest@1
              after transform : content-type=application/json
              pass4
              Starting Jetty on port 8888
                 [WARN] EXCEPTION 
              java.io.IOException: The filename, directory name or volume label syntax is incorrect
              	at java.io.WinNTFileSystem.canonicalize0(Native Method)
              	at java.io.Win32FileSystem.canonicalize(Unknown Source)
              	at java.io.File.getCanonicalPath(Unknown Source)
              	at org.eclipse.jetty.util.resource.FileResource.getAlias(FileResource.java:195)
              	at org.eclipse.jetty.server.handler.ContextHandler.getResource(ContextHandler.java:1584)
              	at org.eclipse.jetty.webapp.WebAppContext.getResource(WebAppContext.java:360)
              	at org.eclipse.jetty.webapp.WebAppContext$Context.getResource(WebAppContext.java:1325)
              	at org.eclipse.jetty.servlet.DefaultServlet.getResource(DefaultServlet.java:380)
              	at org.eclipse.jetty.server.ResourceCache.lookup(ResourceCache.java:190)
              	at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:449)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
              	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
              	at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
              	at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
              	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
              	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
              	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
              	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
              	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
              	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
              	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.Server.handle(Server.java:370)
              	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
              	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
              	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
              	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
              	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
              	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
              	at java.lang.Thread.run(Unknown Source)
                 [WARN] EXCEPTION 
              java.io.IOException: The filename, directory name or volume label syntax is incorrect
              	at java.io.WinNTFileSystem.canonicalize0(Native Method)
              	at java.io.Win32FileSystem.canonicalize(Unknown Source)
              	at java.io.File.getCanonicalPath(Unknown Source)
              	at org.eclipse.jetty.util.resource.FileResource.getAlias(FileResource.java:195)
              	at org.eclipse.jetty.server.handler.ContextHandler$ApproveNonExistentDirectoryAliases.check(ContextHandler.java:2543)
              	at org.eclipse.jetty.server.handler.ContextHandler.getResource(ContextHandler.java:1593)
              	at org.eclipse.jetty.webapp.WebAppContext.getResource(WebAppContext.java:360)
              	at org.eclipse.jetty.webapp.WebAppContext$Context.getResource(WebAppContext.java:1325)
              	at org.eclipse.jetty.servlet.DefaultServlet.getResource(DefaultServlet.java:380)
              	at org.eclipse.jetty.server.ResourceCache.lookup(ResourceCache.java:190)
              	at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:449)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
              	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
              	at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
              	at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
              	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
              	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
              	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
              	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
              	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
              	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
              	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.Server.handle(Server.java:370)
              	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
              	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
              	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
              	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
              	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
              	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
              	at java.lang.Thread.run(Unknown Source)
                 [WARN] EXCEPTION 
              java.io.IOException: The filename, directory name or volume label syntax is incorrect
              	at java.io.WinNTFileSystem.canonicalize0(Native Method)
              	at java.io.Win32FileSystem.canonicalize(Unknown Source)
              	at java.io.File.getCanonicalPath(Unknown Source)
              	at org.eclipse.jetty.util.resource.FileResource.getAlias(FileResource.java:195)
              	at org.eclipse.jetty.server.handler.ContextHandler.getResource(ContextHandler.java:1584)
              	at org.eclipse.jetty.webapp.WebAppContext.getResource(WebAppContext.java:360)
              	at org.eclipse.jetty.webapp.WebAppContext$Context.getResource(WebAppContext.java:1325)
              	at org.eclipse.jetty.servlet.DefaultServlet.getResource(DefaultServlet.java:380)
              	at org.eclipse.jetty.server.ResourceCache.lookup(ResourceCache.java:190)
              	at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:473)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
              	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
              	at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
              	at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
              	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
              	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
              	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
              	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
              	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
              	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
              	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.Server.handle(Server.java:370)
              	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
              	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
              	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
              	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
              	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
              	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
              	at java.lang.Thread.run(Unknown Source)
                 [WARN] EXCEPTION 
              java.io.IOException: The filename, directory name or volume label syntax is incorrect
              	at java.io.WinNTFileSystem.canonicalize0(Native Method)
              	at java.io.Win32FileSystem.canonicalize(Unknown Source)
              	at java.io.File.getCanonicalPath(Unknown Source)
              	at org.eclipse.jetty.util.resource.FileResource.getAlias(FileResource.java:195)
              	at org.eclipse.jetty.server.handler.ContextHandler$ApproveNonExistentDirectoryAliases.check(ContextHandler.java:2543)
              	at org.eclipse.jetty.server.handler.ContextHandler.getResource(ContextHandler.java:1593)
              	at org.eclipse.jetty.webapp.WebAppContext.getResource(WebAppContext.java:360)
              	at org.eclipse.jetty.webapp.WebAppContext$Context.getResource(WebAppContext.java:1325)
              	at org.eclipse.jetty.servlet.DefaultServlet.getResource(DefaultServlet.java:380)
              	at org.eclipse.jetty.server.ResourceCache.lookup(ResourceCache.java:190)
              	at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:473)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
              	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
              	at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
              	at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83)
              	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
              	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
              	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
              	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
              	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
              	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
              	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
              	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
              	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
              	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
              	at org.eclipse.jetty.server.Server.handle(Server.java:370)
              	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
              	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
              	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
              	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
              	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
              	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
              	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
              	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
              	at java.lang.Thread.run(Unknown Source)
              [WARN] 404 - GET /://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch3 (127.0.0.1) 1426 bytes
                 Request headers
                    Accept: */*
                    If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT
                    Referer: http://127.0.0.1:8888/BuiltInDS.html?gwt.codesvr=127.0.0.1:9997
                    Accept-Language: en-GB,en;q=0.8,zh-Hant-HK;q=0.5,zh-Hant;q=0.3
                    Accept-Encoding: gzip, deflate
                    User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
                    Host: 127.0.0.1:8888
                    DNT: 1
                    Connection: keep-alive
                    Cache-Control: no-cache
                    Cookie: JSESSIONID=sog2cae6qgdy1d0i5zvsrhav2; isc_cState=ready; GLog=%7B%0D%20%20%20%20trackRPC%3Afalse%0D%7D
                 Response headers
                    X-Included-Test2: true
                    X-Included-Test: true
                    Content-Type: text/html;charset=ISO-8859-1
                    Cache-Control: must-revalidate,no-cache,no-store
                    Content-Length: 1426
              === 2015-03-25 22:18:45,752 [9-27] INFO  RequestContext - URL: '/builtinds/sc/skins/Enterprise/images/loadingSmall.gif', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko': Unsupported with Accept-Encoding header
              === 2015-03-25 22:18:45,758 [9-27] INFO  Download - done streaming: Y:/eclipse-jee-indigo-SR2-win32-x86_64/workspace4/builtinds/war/builtinds/sc/skins/Enterprise/images/loadingSmall.gif

              In Development Mode view, the error is a follows:-

              Code:
              [ERROR] [builtinds] - 22:18:45.835:TMR7:WARN:ResultSet:isc_ResultSet_0 (dataSource: country, created by: isc_ListGrid_1):Bad data returned, ignoring: "Transport error - HTTP code: 404 for URL: ://localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch3"

              I attached the following network message captured using F12 in Firefox Browser to show the following:-
              - Request Header
              - Response Header
              - Response Body
              - Expected Response from my REST server captured by POSTMAN session

              Please help me to progress to next step.
              Attached Files

              Comment


                #8
                Hi Kay Chee,

                try to remove "://" from your URL as well - you can see the URL Firefox is accessing in your first screenshot. It just does not look right.

                Best regards,
                Blama

                Comment


                  #9
                  hi Blama,
                  Thank you for your suggestion.
                  I tried different combinations for dataURL. They all end up with error.

                  1. dataURL="//localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch3"

                  Error is same as when dataURL="http://localhost:8980/......"", i.e. permission denied

                  2. dataURL="/localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch3"
                  Error is same as when dataURL="://localhost:8980...", i.e. [ERROR] [builtinds] - 21:17:42.018:TMR2:WARN:ResultSet:isc_ResultSet_0 (dataSource: country, created by: isc_ListGrid_1):Bad data returned, ignoring: "Transport error - HTTP code: 404 for URL: /localhost:8980/RESTTEST/rest/RESTTESTService/countryFetch3"


                  3. dataURL="localhost:8980/..."
                  same error as when dataURL="localhost:8980...", i.e. permission denied.

                  Comment


                    #10
                    You need to use the correct relative URL for your REST service.

                    It should not have localhost or a port number. It should just be a relative path.

                    Getting the right relative path is really simple stuff: it's just like using the correct relative path to load resources like .js files or images.

                    Comment


                      #11
                      Hi Administrator,
                      I remove localhost and port number as follows:-
                      dataURL="RESTTEST/rest/RESTTESTService/countryFetch3"

                      I got the same '404 not found' error.

                      Code:
                      22:49:28.069 [ERROR] [builtinds] 22:49:28.069:TMR1:WARN:ResultSet:isc_ResultSet_1 (dataSource: country, created by: isc_ListGrid_1):Bad data returned, ignoring: "Transport error - HTTP code: 404 for URL: RESTTEST/rest/RESTTESTService/countryFetch3"
                      com.smartgwt.client.core.JsObject$SGWT_WARN: 22:49:28.069:TMR1:WARN:ResultSet:isc_ResultSet_1 (dataSource: country, created by: isc_ListGrid_1):Bad data returned, ignoring: "Transport error - HTTP code: 404 for URL: RESTTEST/rest/RESTTESTService/countryFetch3"
                          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                          at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                          at java.lang.reflect.Constructor.newInstance(Unknown Source)
                          at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                          at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
                          at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
                          at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
                          at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
                          at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
                          at java.lang.Thread.run(Unknown Source)
                      I got similar error is I added "/" in front of the above URL:-
                      dataURL="/RESTTEST/rest/RESTTESTService/countryFetch3"

                      Do I need to specify somewhere the baseURL as localhost:8980?
                      Please help.

                      Thanks and regards

                      Comment


                        #12
                        Again, you just need to specify a correct relative URL, just like loading resources such as JavaScript files or images.

                        If the service is on a different port from the URL of the main web page, you will need to resolve that problem so both the service and the web page contacting it are on the same port. Web browsers do not in general allow talking to different ports, even on the same machine (called the same origin policy)

                        None of this is SmartClient-specific - this is HTML and web basics - so if these concepts are not familiar, try looking them up on other sites.

                        Comment

                        Working...
                        X