# Client funktioniert nicht



## roadrunner87 (24. Nov 2011)

Hallo,
habe einen Webservice mit Java mit jaxws programmiert und bekommen, wenn ich den client starten will, folgenden fehler.


```
Run client:
     [code=Java] Exception in thread "main" javax.xml.ws.WebServiceException: Could not send Message.
     [code=Java] 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
     [code=Java] 	at $Proxy19.prepareValidationWithDefaultLease(Unknown Source)
     [code=Java] 	at de.htwaalen.webservice.client.Client.main(Client.java:62)
     [code=Java] Caused by: java.net.MalformedURLException: Invalid address. Endpoint address cannot be null.
     [code=Java] 	at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:735)
     [code=Java] 	at org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:719)
     [code=Java] 	at org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:666)
     [code=Java] 	at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:459)
     [code=Java] 	at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
     [code=Java] 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
     [code=Java] 	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
     [code=Java] 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
     [code=Java] 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
     [code=Java] 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
     [code=Java] 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
     [code=Java] 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
     [code=Java] 	... 2 more
     [code=Java] Java Result: 1
BUILD SUCCESSFUL
Total time: 2 seconds
```


Was mache ich falsch. Habe schon alles probiert.

Danke


----------



## Firestorm87 (24. Nov 2011)

"Endpoint address cannot be null."

Du solltest dir die Ziel-URL deines Webservices nochmal anschauen.


----------



## roadrunner87 (24. Nov 2011)

Hallo,
danke für deine Antwort.

Ich habe das im Client folgendermaßen.




```
public class Client {
	/**
	 * The service name.
	 */
    private static final QName SERVICE_NAME 
    	= new QName("http://server.webservice.htwaalen.de/", "IMacker");
    
    
    /**
     * the port name.
     */
    private static final QName PORT_NAME 
    	= new QName("http://server.webservice.htwaalen.de/", "MackerPort");
    
    
    /**
     * Constructs a new client.
     */
    private Client() { } 
    
    
    
    /**
     * Method to test the functionality of the client.
     * Only for testing.
     * 
     * @param args -
     * @throws Exception
     */
    public static void main(String args[]) throws Exception {
        Service service = Service.create(SERVICE_NAME);
        // Endpoint Address
        String endpointAddress = "http://localhost:9000/Macker";

        // Add a port to the Service
        service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
        
        IMacker m = service.getPort(IMacker.class);
        
        // Call interfaces
        // ...
        //MackerImpl m = new MackerImpl();
		final String pathToTestFolder	= "testfiles/";
		final String configFile			= pathToTestFolder + "config.xml";        
        String act = m.prepareValidationWithDefaultLease(configFile);
        m.getDebugInfoCount(act);
    }
}
```


Der Server sieht folgendermaßen aus:


```
public class Server {
	
	/**
	 * Creates a new Server.
	 * 
	 * @throws Exception
	 */
    protected Server() throws Exception {
        // START SNIPPET: publish
        System.out.println("Starting Server");
        MackerImpl implementor = new MackerImpl();
        String address = "http://localhost:9000/Macker";
        Endpoint.publish(address, implementor);
        // END SNIPPET: publish
    }
    
    
    
    /**
     * Method to test the functionality of the server.
     * Only for testing.
     * 
     * @param args -
     * @throws Exception
     */
    public static void main(String args[]) throws Exception {
        new Server();
        System.out.println("Server ready...");

        Thread.sleep(5 * 60 * 1000);
        System.out.println("Server exiting");
        System.exit(0);
    }
}
```


Unsere WebService Schnittstelle ist:


```
@WebService(endpointInterface = "de.htwaalen.webservice.server.IMacker",
			serviceName = "IMacker")
public class MackerImpl implements IMacker {	
....

}
```



Ich sehe leider den Fehler nicht.


----------

