Richard Rhyan
Richard Rhyan

Reputation: 213

Connecting Remotely with Java Web Services

Can someone please tell me what I'm doing wrong? I'm trying to put together a quick web service test just to see if I can get it to work for now. The problem I'm having is that, as shown below, it does not work, but if I change the URL and replace "myWebsite.com" with "localhost" it works. So, I know the server side is working (I've still checked and double checked it though). But I'll need this to work through remote clients, and I just cannot get it to work. Any help would be greatly appreciated.

package stickman.Server;

import java.net.*;
import javax.xml.namespace.*;
import javax.xml.ws.*;
import stickman.Combined.*;
public class TestApp {

public static void main(String[] args) throws Exception {

    // --------------------------------------------
    // changing "myWebite.com" to "localhost" works
    URL url = new URL(
        "http://myWebsite.com:32768/home/rhyan/workspace/Stickman/bin/stickman/Server");
    // --------------------------------------------

    QName qname = new QName("http://Server.stickman/","StickmanServerService");
    Service service = Service.create(url, qname);
    StickmanServerInterface ssi = service.getPort(StickmanServerInterface.class);

    Account a = ssi.getAccount("This is a test");
    System.out.println(a.getUserId());

}

}

Edit: here's the error tracking...

Exception in thread "main" com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException.

java.net.ConnectException: Connection refused
java.net.ConnectException: Connection refused

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:161)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:133)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:254)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:217)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:165)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
at javax.xml.ws.Service.<init>(Service.java:76)
at javax.xml.ws.Service.create(Service.java:700)
at stickman.Server.ServerTestApp.main(ServerTestApp.java:17)

Upvotes: 0

Views: 10901

Answers (3)

Richard Rhyan
Richard Rhyan

Reputation: 213

It took 8 days of reading a plethora of stuff online before I finally found the answer to my problem through a random google search I came up with: Publishing a WS with Jax-WS Endpoint

"localhost" should be 0.0.0.0, and I totally should have known this. Thanks to the people who tried to help.

Upvotes: 1

Biju Kunjummen
Biju Kunjummen

Reputation: 49915

Your exception indicates that the wsdl for the service is not accessible - not the service itself. Can you confirm that the wsdl for the service is available at this location - http://myWebsite.com:32768/home/rhyan/workspace/Stickman/bin/stickman/Server, and the url in the wsdl points to a proper working endpoint.

Upvotes: 1

cgull
cgull

Reputation: 1417

Could be a DNS problem? What IP address do you resolve myWebsite.com to?

Upvotes: 1

Related Questions