aspose file tools*
The moose likes Web Services and the fly likes Can't connect to my web service remotely (very basic example) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Can Watch "Can New topic
Author

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

Will Farquharson
Greenhorn

Joined: Dec 02, 2008
Posts: 20

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
Bartender

Joined: Oct 14, 2005
Posts: 18135
    
    8

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

Joined: Dec 02, 2008
Posts: 20

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can't connect to my web service remotely (very basic example)
 
Similar Threads
Tomcat as Public Web Server
RMI CodeBase => slowdown
rmiregistry on a different machine
Conversion of message to SOAP in web service
HTTPS hostname wrong: should be 1.2.3.4