NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Example Netbeans about Client Stubs RESTful doesn't work

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
pakkk



Joined: 25 Jun 2009
Posts: 8

PostPosted: Wed Jul 01, 2009 3:57 pm    Post subject: Example Netbeans about Client Stubs RESTful doesn't work Reply with quote

Hi, I'm doing a project and I would need RESTful Web Services (with Client Stubs RESTful)

Well, Netbeans.org offers an example to use Client Stubs when I want to catch objects JSON of a RESTful response:

http://wiki.netbeans.org/RESTRemoting.

When I invoke, for example, the getCustomersSize() function (that appears in "CustomerApp/web/customerapp.js"):

function getCustomersSize() {
var customersObj = getCustomers();
var customers = customersObj.getItems();
return customers.length;
}

I use an alert javascript and I see that It returns 0:

alert("Customers size: " + getCustomersSize());

In my own application (my project) too.

I use another alert to see the "customersObj" attributes and I receive all!

for (var atrib in customersObj){
alert("Attribute: " + atrib);
}


Thank you so much!
Back to top
pakkk



Joined: 25 Jun 2009
Posts: 8

PostPosted: Wed Jul 01, 2009 6:56 pm    Post subject: Bug in Client Stub code generation of RESTful Reply with quote

I have found a bug in Client Stub code generation of Restful.

Function init (for example in class Customer.js):

1 var myObj = eval('(' +c+')');
2 var customer = myObj.customer; // <-- Bug code generation
3 this.uri = customer['@uri'];
4 this.customerId = this.findValue(this.customerId, customer['customerId']);
5 this.zip = this.findValue(this.zip, customer['zip']);
6 this.name = this.findValue(this.name, customer['name']);

... ... ...

The error appears in the second line. myObj is the CustomerObject and not "myObj.customer". The correct code is the next:

1 var myCustomer = eval('(' +c+')');
2 this.uri = myCustomer['@uri'];
3 this.customerId = this.findValue(this.customerId, myCustomer['customerId']);
4 this.zip = this.findValue(this.zip, myCustomer['zip']);
5 this.name = this.findValue(this.name, myCustomer['name']);


Greetings,
Paco.
Back to top
xworker



Joined: 09 Jul 2009
Posts: 1

PostPosted: Thu Jul 09, 2009 9:30 am    Post subject: Can't get the rest client to work Reply with quote

Hi

I'm trying to generate rest ws client accordingly to this guide:
http://www.netbeans.org/kb/60/websvc/clientstub.html#stubs

But I get a StringOutOfBounds exception when trying to generate the client stubs. Nothing gets generated...

What could be wrong?

/x
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo