Hi Folks,
I'm deploying a simple EJB 3.0 web service using the following code (based on
the hello-jaxws sample that comes with the Java EE 5 distribution):
package endpoint;
|
| import javax.ejb.Stateless;
| import javax.jws.WebService;
| import javax.jws.WebMethod;
|
| @WebService
| @Stateless
| public class Hello
| {
| @WebMethod
| public String getHello(String name)
| {
| return "Hello " + name + "!";
| }
| }
I'm packaging it into a JAR and deploying to JBoss 4.0.4.GA, and the WSDL shows
up fine from http://localhost:8080/jbossws. The WSDL name is as expected
(http://localhost:8080/hello/Hello?wsdl).
I'm using wsimport to generate the client stub code using the following ant
task:
<target name="get-artifacts-windows" if="windows">
| <exec executable="${javaee.home}/bin/wsimport.bat">
| <arg line="-keep -d ./build/classes
http://localhost:8080/hello/Hello?wsdl"/>
| </exec>
| </target>
This also seems to work as expected, and my test client (shown below) will
compile.
| /*
| * Client.java
| */
|
| package client;
|
| import javax.xml.ws.WebServiceRef;
| import endpoint.jaws.HelloService;
| import endpoint.jaws.Hello;
|
| public class Client
| {
| @WebServiceRef(wsdlLocation="http://localhost:8080/hello/Hello?wsdl")
| static HelloService service;
|
| public static void main(String[] args)
| {
| Client client = new Client();
| client.doHello();
| }
|
| public void doHello()
| {
| try
| {
| Hello port = service.getHelloPort();
| String ret = port.getHello(System.getProperty("user.name"));
| System.out.println("Hello result = " + ret);
| }
| catch(Exception e)
| {
| e.printStackTrace();
| }
| }
| }
Unfortunately, when I try to actually run the client, I get the following:
[java] java.lang.NullPointerException
[java] at client.Client.doHello(Client.java:28)
[java] at client.Client.main(Client.java:21)
I added debugging statements and determined that the method generated by
wsimport to get the port doesn't seem to be working properly, but that's as far
as I can get!
Can anyone help me resolve this problem?
Thanks in advance,
Tim
PS I'm certainly willing to use wstools instead of wsimport, but I couldn't
find an example for generating a client using a JAX-WS client (rather than a
JAX-RPC client)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963664#3963664
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963664
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user