views:

254

answers:

6

Hi,

I am trying to create a WebService. I am not able to access the URL. If I try to connect to

http://192.168.10.203:8080/EchoBeanService/EchoBean?wsdl

I get an error:

Firefox can't establish a connection to the server at 192.168.10.203:8080

However, if I am able to connect to the using localhost in the URL:

http://localhost:8080/EchoBeanService/EchoBean?wsdl 

Echo.java

package services;

public interface Echo {
    public String printEcho();
    public String printEchoParam(String str);

}

EchoBean.java package model;

import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import services.Echo;

@Stateless
@WebService
public class EchoBean implements Echo {
public EchoBean(){}
@WebMethod
    public String printEcho(){
        return "WebServices Echo ";
    }
@WebMethod
    public String printEchoParam(String str){
        return ("In PrintEcho( String " + str +" )" );
    }
}

-H

A: 

Check the following:

  • Is 192.168.10.203 your IP address?
  • Do you have any firewall on the appropriate network interface (the interface of 192.168.10.203), that might block the connection?
SztupY
A: 

Also some application servers disable remote connections by default for security reasons. Your server might have to be setup to allow remote connections.

You can check network connectivity by using telnet to connect to the port.

telnet 192.168.10.203 8080
sisslack
A: 

If you are running on Linux you might be blocked by IPTABLE. Try to disable that and see if you can connect from your remote IP/Hostname.

Either way it seems like a firewall issues or incorrect IP address. Look up your IP Address with ifconfig (unix based) or ipconfig (win)

Bernie Perez
I use static IP Address. I was able to ping my IPAddress through remote machine. On server itself when I had:http://localhost:8080/EchoBeanService/EchoBean?wsdl it worked fine, while it gave me error with http://192.168.10.203:8080/EchoBeanService/EchoBean?wsdlSurprisingly, I was able to access the WSDL when I replaced the IPAddress with the hostname :http://hostname:8080/EchoBeanService/EchoBean?wsdl
When you ping the hostname, what IP address does it resolve to? Does it attempt to ping 192.168.10.203?
Bernie Perez
+1  A: 

I have absolutely no knowledge of java, but this symptom doesn't seem all that unique to web services in general. Maybe something to do with either this java app or the server by default binding only to or listening at localhost:8080? Maybe this would help to change that: http://stackoverflow.com/questions/2490737/how-to-change-webservice-url-endpoint

Similar instructions, specifically the 'Deploying the Web Service' section: http://today.java.net/article/2006/06/12/web-services-made-easy-jax-ws-20

Otherwise, like folks said above: check your local firewall to see if incoming connections are blocked, or verify the IP addressed assigned to the system this service is running on.

bob_the_destroyer
A: 

If this is a home network, I know that some routers/modems don't like looping back to themselves (I have seen this behavior with linksys devices). But localhost still works, because the OS catches it before it goes out to the network appliance. Have you tried connecting to any other ports on your machine, or just doing a ping of the IP address to see if it responds?

M. Jessup
A: 

Thank you all,

Resolved the issue by reinstalling my glassfish server.