Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Netbeans jax-ws generated sources erroring on method invocation.

 
Jeremy James Brown
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used the netbeans 7.1 wizard to create a web application consume a web service. New > Java Web > Web Aplication, then New WebService Client... > Browse for web service, then New > Servlet.

When I try to create the entity class to do a create with in the web service all of the methods for the entity class error.



The same exact code (cut and pasted) in a similarly generated Java SE test application compiles and creates a record just fine. Am I missing something simple?

here is the entity POJO below. It has no zero arg constructor but the compiler should provide that. Neither does the SE version.




 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I try to create the entity class to do a create with in the web service all of the methods for the entity class error.

Can you elaborate this with errors you get?
 
Jeremy James Brown
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 23 bd2.setId("ID10008"); <= "package bd2 does not exist <identifier> expected illegal start of type"

If I move the setter calls into the processRequest method this problem goes away. This solution has allowed me to move forward with my development of the web service client, but I would still like to understand the cause of this error.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What "of.createBankdata();" returns? And were you able to import the package "webservice.Bankdata" through the IDE (not manually by typing the entire thing)?
 
Jeremy James Brown
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:What "of.createBankdata();" returns? And were you able to import the package "webservice.Bankdata" through the IDE (not manually by typing the entire thing)?


I think the issue here is calling any kind of method above the method declarations in the Servlet.



I think there is probably some lesson I really need to learn about Servlets in here somewhere. Because this makes no sense to me.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! I missed it, Yes you need to use them inside methods, it's no difference form any other regular Java class as far as using methods from objects.
 
Jeremy James Brown
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:Oh! I missed it, Yes you need to use them inside methods, it's no difference form any other regular Java class as far as using methods from objects.


For readers who may be looking at this because they did the same silly thing I did. You can do any setup method calls in the servlet init() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic