[jboss-user] [JBossWS] - Newbie question: Just a first webservice client
NautilusIII
do-not-reply at jboss.com
Mon Aug 28 18:29:48 EDT 2006
Hi!
I have developed my very first webservice with JSR181:
| /**
| * SimpleWebServiceImpl.java
| *
| * This file was auto-generated from WSDL
| * by the Apache Axis 1.3 Oct 05, 2005 (05:23:37 EDT) WSDL2Java emitter.
| */
|
| package ws;
|
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
|
| @WebService
| @SOAPBinding(style = SOAPBinding.Style.RPC)
| public class SimpleWebService
| {
| @WebMethod
| public int add(int a, int b)
| {
| return a+b;
| }
|
| @WebMethod
| public int sub(int a, int b)
| {
| return a-b;
| }
|
| @WebMethod
| public int mul(int a, int b)
| {
| return a*b;
| }
|
| @WebMethod
| public double div(int a, int b)
| {
| return a/b;
| }
| }
|
The webservice is deployed and I can fetch the wsdl via specifying the appropriate URL in the browser.
| http://localhost:8080/ws2/webservices/SimpleWebService?wsdl
|
But I cannot manage it to develop a simple standalone client...
I tried this here:
| package ws;
|
| import javax.xml.ws.WebServiceRef;
|
| public class SimpleWebServiceClient
| {
| @WebServiceRef(wsdlLocation = "http://localhost:8080/ws2/webservices/SimpleWebService?wsdl")
| static SimpleWebService service;
|
| public static void main(String[] args)
| {
| System.out.println(service.add(2,3));
| }
| }
|
I doing all these from within Eclipse with Lomboz...
I referenced the project containg the service from within my client project and just executed the client from within Eclipse...
But I always get a NullPtrExc because the variable service is always null in
| System.out.println(service.add(2,3));
|
What am I doing wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967950#3967950
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967950
More information about the jboss-user
mailing list