WebServiceRef annotation [message #253950] |
Tue, 15 April 2008 13:34 |
Eclipse User |
|
|
|
Originally posted by: zihamesh.yahoo.com
I'm trying to run a sample web services client from Sun's java web service
tutorial, and I suspect that my problem is due to the use of an annotation
in the class rather than a bug in the code.
I'm not too familiar with annotations.
I am using java 1.6, and have annotation processing enabled.
Everything works fine if I build and run from the command line using ant,
so the client code, the server, and the service I'm trying to run are all
ok. However, when I try to run the client from Eclipse, I get a null
pointer exception.
Below is the first part of the code, and when running from Eclipse, I get
a null pointer exception on the line Hello port = service.getHelloPort();
because service is null.
I'm guessing that something should treat the @WebServiceRef(...) and the
following HellowService declaration as if the service class variable was
being initialised to an instance of HelloService using the WSDL specified
in the annotation parameter. Is that assumption correct, and how can I fix
the problem.
Thanks,
Ziham.
-------------------------------------------------------
Code from Sun's Java Web Services tutorial.
import javax.xml.ws.WebServiceRef;
public class HelloClient {
@WebServiceRef(wsdlLocation="http://localhost:8080/helloservice/hello?wsdl")
static HelloService service;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
HelloClient client = new HelloClient();
client.doTest(args);
} catch(Exception e) {
e.printStackTrace();
}
}
public void doTest(String[] args) {
try {
System.out.println("Retrieving the port from the following
service: " + service);
Hello port = service.getHelloPort(); // <--- NPE here because
service is null.
...
|
|
|
Re: WebServiceRef annotation [message #253954 is a reply to message #253950] |
Tue, 15 April 2008 14:06 |
Wayne Beaton Messages: 554 Registered: December 2017 |
Senior Member |
|
|
How are you running this. Are you using "Run on Server..." ?
What application server are you using? What version of web tools? Can
you configure/administer/run your application server from the servers
view?
Wayne
On Tue, 2008-04-15 at 13:34 +0000, Ziham wrote:
> I'm trying to run a sample web services client from Sun's java web service
> tutorial, and I suspect that my problem is due to the use of an annotation
> in the class rather than a bug in the code.
>
> I'm not too familiar with annotations.
>
> I am using java 1.6, and have annotation processing enabled.
>
> Everything works fine if I build and run from the command line using ant,
> so the client code, the server, and the service I'm trying to run are all
> ok. However, when I try to run the client from Eclipse, I get a null
> pointer exception.
>
> Below is the first part of the code, and when running from Eclipse, I get
> a null pointer exception on the line Hello port = service.getHelloPort();
> because service is null.
>
> I'm guessing that something should treat the @WebServiceRef(...) and the
> following HellowService declaration as if the service class variable was
> being initialised to an instance of HelloService using the WSDL specified
> in the annotation parameter. Is that assumption correct, and how can I fix
> the problem.
>
> Thanks,
>
> Ziham.
>
> -------------------------------------------------------
> Code from Sun's Java Web Services tutorial.
>
> import javax.xml.ws.WebServiceRef;
>
> public class HelloClient {
>
> @WebServiceRef(wsdlLocation="http://localhost:8080/helloservice/hello?wsdl")
> static HelloService service;
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
> try {
> HelloClient client = new HelloClient();
> client.doTest(args);
> } catch(Exception e) {
> e.printStackTrace();
> }
> }
>
> public void doTest(String[] args) {
> try {
> System.out.println("Retrieving the port from the following
> service: " + service);
> Hello port = service.getHelloPort(); // <--- NPE here because
> service is null.
>
> ..
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.08202 seconds