This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 153274

Summary: Generated .js files in RESTful Web Service Client Stubs.
Product: webservices Reporter: gmaniloff <gmaniloff>
Component: RESTAssignee: Ayub Khan <ayubskhan>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://http://www.netbeans.org/kb/60/websvc/clientstub.html
Issue Type: DEFECT Exception Reporter:
Attachments: Customers client stub
Customer client stub

Description gmaniloff 2008-11-16 13:46:32 UTC
Hello,

     Versions: Netbeans 6.5 RC2 / Tomcat 6.018 / Toplink / Jersey 1.0 / Jax-RS 1.0 / Sql Server 2005 (tested on mySql
5.0 and Derby 10)

Symptom:  When you do the Step 7 of the "Creating Restful Web Service Client stubs" the data of your database is not
shown and you will get an error of a Proxy needed becose the function resource.getItems() returns 0.

Problem: On all the Init() functions of the .js generated files says this:

      note: in this case we will open the Customer.js file.

      init : function() {
      var remote = new CustomerRemote(this.uri);
      var c = remote.getJson_();
      if(c != -1) {
         var myObj = eval('(' +c+')');
         var customer = myObj.customer;
      ......
 
The contents of remote.getJson_() has a reference of an "customess" object but not to the "customer" object so.. the
folowing line

         var customer = myObj.customer;

Asigns an undefined and null object to the var customer

Fix:
 
      In all the generated .js rest files:

      replace the line ->>   var customer = myObj.customer;
      with the line ---->>   var customer = myObj;

This was tested on other projects with same results.


Regards.
Guillermo Maniloff
from Argentina
Comment 1 Ayub Khan 2008-12-01 23:05:14 UTC
This issue is a duplicate of 150367 and is fixed in NB6.5 FCS. Please
try NB6.5 FCS to verify this.

*** This issue has been marked as a duplicate of 150367 ***
Comment 2 Ayub Khan 2008-12-02 22:38:49 UTC
I am sorry, the fix http://hg.netbeans.org/main/rev/c771ff3b8fde somehow didn't make it into NB6.5. We are planning to
put this fix into NB 6.5 patch2. In the meanwhile you can try either

1) the NB dev build from http://bits.netbeans.org/download/trunk/nightly/latest/ or
2) Use the attached sample to fix generated .js files for your project.
Atttached files Customers.js (the container script that communicates with CustomersResource) and Customer.js (the
container item script that communicates with CustomerResource)
Comment 3 Ayub Khan 2008-12-02 22:39:49 UTC
Created attachment 74445 [details]
Customers client stub
Comment 4 Ayub Khan 2008-12-02 22:40:05 UTC
Created attachment 74446 [details]
Customer client stub
Comment 5 Ayub Khan 2008-12-03 17:33:21 UTC
According to QA, since its already fixed for 7.0 M1, this issue can be closed as fixed.

Hi Guillermo Maniloff,

Please use either solutions
1) the NB dev build from http://bits.netbeans.org/download/trunk/nightly/latest/ or
2) Use the attached sample to fix generated .js files for your project.
Atttached files Customers.js (the container script that communicates with CustomersResource) and Customer.js (the
container item script that communicates with CustomerResource)
3) Also this fix will make it into 7.0 milestone1 release (tentative date 3rd week of December)

Thanks
Ayub