• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with consuming a SOAP web server client

 
Giulio Savoca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all! i am new to Java (I used it for one year at school, then i forgot all i've learned) and to Java Web Service programming.
I have the following problem.
I am trying to create a servlet which communicates with a public webserver, i followed a guide online and i have created a Dynamic Web Project into Eclipse, i put the WSDL and Eclipse create the .java files from the Web Server.
Now i write code, and everytime i try to run i got "HTTP Status 500 - Error istantiating servlet class

Can you help me to figure out from this error is about 2 days that i try solution over solution.

Here's the servlet code



Here's the project structure.


With NetBeans it's relative easy, and infact it works, but with Eclipse not, i created a Test Client from the project and the methods work all. So i write something wrong for sure. Thanks you all anticipately for the possibile answers!
 
Giulio Savoca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is wrong. Lines 27 and 28 doesn't exist. The right code is this

But it doesn't work the same.
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be a stack trace in the server logs that explains what the issue is.

However, a Servlet should not have state.
That is, you shouldn't be setting up that service there.

What happens if you set up the service where you actually use it, in the doGet?

one code comment.
Do not do that in the doPost.
It should throw a 405 (I think that's the no such method one).
 
Giulio Savoca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have fixed! After 3 days of working i finally figured out!
The problem was on the service variable declaration, i used "net.webservicex.www.GeoIPServiceLocator" as type, but i should used "GeoIPService" and the use "new GeoIPServiceLocator()" and then all works fine.
I put a try catch into doGet() where i put this "GeoIP ip = service.getGeoIPServiceSoap().getGeoIPContext();" for use APIs.

Maybe this will be usefull in the future (I hope no, SOAP must be deleted from the world's face  )
 
ronald silva
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, Giulio, please could you put the whole correct code in this post?
I am learning about servlet and webservices too.
you said that you replaced some lines... but is hard to me understand exactly what you changed in the code.
thanks in advance.
 
Giulio Savoca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ronald silva wrote:hi, Giulio, please could you put the whole correct code in this post?
I am learning about servlet and webservices too.
you said that you replaced some lines... but is hard to me understand exactly what you changed in the code.
thanks in advance.


Yes, here the whole correted code


Hope this will be helpfull!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic