users@jax-ws.java.net

RE: How to write a client with JAX-WS final release

From: Lukasz Chomin <lukaszc_at_computec.com.pl>
Date: Sun, 21 May 2006 16:32:27 +0200

I found a solution. It's working when I explicitly create an object:

package simpleclient;

import helloservice.endpoint.proxy.Hello;
import helloservice.endpoint.proxy.HelloService;

import javax.xml.ws.WebServiceRef;

public class HelloClientNew {

    //_at_WebServiceRef(wsdlLocation =
"http://sun02:8080/JAXWS/HelloService?WSDL")
    //_at_WebServiceRef(Hello.class)

        //that way this is working
    static HelloService service = new HelloService();
        
        //this is not enough
        //static HelloService service;

    public static void main(String[] argv) {
        try {

            Hello port = service.getHelloPort();
            String response = port.sayHello("Lukasz");
            System.out.println(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

It looks like the @WebServiceRef annotations is not working at all. There is
no difference it is or not.
Can anybody explain why?

Thanks.
Lukasz Chomin