Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't connect to my web service remotely (very basic example)

 
Will Farquharson
Greenhorn
Posts: 20
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've been using Netbeans 6 to get to grips with Java Web Services, and I've developed them exclusively using this IDE including a client program to consume them.

Everything has been working fine when running my server and client on the same machine, but I've recently been trying to get my client to talk to the web service when it's deployed somewhere remote and I must be missing a huge step somewhere because I simply can't get this to work.

I can view the WSDL file through a web browser fine, so I know the correct port is open and the web services should be there - but when my client tries to call the very first method on the web service, it says "Connection Refused" - I've made sure everything that used to previously reference "localhost" now references the external IP address in all the classes on the client, but I must be missing something else, or there is a configuration issue.

It may be worth noting that this link:
http://localhost:8080/Evaluator/EvaluatorService?Tester
...works fine on the server machine, but if I try to call it remotely by replacing "localhost" with an IP address, I get displayed on the page...

"Exceptions details : null
java.lang.NullPointerException at java.io.File.(File.java:222)
at com.sun.enterprise.webservice.monitoring.WebServiceTesterServlet.initializePort(WebServiceTesterServlet.java:524) at..."


...which seems a bit meaningless :-( I don't understand why this wouldn't return the same page as it does on the local machine?

I realise this is probably a very basic question, I still have absolutely heaps to learn about Web Services but I hoped to have this simple system working fairly quickly as a starting point. I've tried looking up some resources, but I either find examples too basic, or far too complicated for me to understand yet. If anyone could give me some pointers as to what to check I would be very grateful...

Thanks!
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I notice that something is trying to use a File object. That doesn't seem like a reasonable thing for a web service to do.

And given that you say your code works when the client and server are the same machine but not when they aren't, it very much makes me suspect that it's your code which is trying to access a file. Naturally code on the server won't be able to access files on the client machine -- at least, not via a File object.
 
Will Farquharson
Greenhorn
Posts: 20
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That link is just to a Web Service testing page that usually appears if you click "Test Web Service" from the right click menu in Netbeans - I'm not sure what it does behind the scenes with files etc, but it usually just displays a list of all the methods you have and lets you invoke them to see if they are work. I thought the fact that this page didn't work remotely might be a good indicator as to why my client can't consume the web service either.... I could be wrong though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic