Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » WebServiceRef annotation
WebServiceRef annotation [message #253950] Tue, 15 April 2008 13:34 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Wayne Beaton is currently offline Wayne BeatonFriend
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.
>
> ..
>
Re: WebServiceRef annotation [message #254052 is a reply to message #253950] Wed, 16 April 2008 16:25 Go to previous message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Ziham" <zihamesh@yahoo.com> wrote in message
news:694a13a35358871c7b657c48e73f225c$1@www.eclipse.org...
> 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.


By the way - I think in this case that annotation processing is not actually
being used (that is, I think these annotations are handled by the server,
not used at compile time).

If I'm wrong, though, then part of your problem might be that you need to
point Eclipse to where the annotation processor is. It's not enough to just
enable annotation processing, that by itself won't do anything. In Project
Properties, go to Java Compiler -> Annotation Processing -> Factory Path to
add jar files that contain annotation processors.
Previous Topic:ant is slow with update 6
Next Topic:global variables in watch window
Goto Forum:
  


Current Time: Tue Sep 17 14:17:46 GMT 2024

Powered by FUDForum. Page generated in 0.09100 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top