[jboss-user] [JBossWS] - EJB client for a Web service

freejohn22 do-not-reply at jboss.com
Mon Nov 3 12:18:39 EST 2008


Hi all!
I'm trying to use an EJB as client for a Web service. Unfortunately I'm having some problems when I'm injecting the WebServiceRef into the EJB.

Here's my code:
This is the WebService in the .war file :

@WebService
  | @SOAPBinding(style = SOAPBinding.Style.RPC)
  | public class POJOWs   implements POJOWsItf
  | {
  |    
  |    @WebMethod
  |    public String echo(String input)
  |    {
  |       return input + " called !";
  |    }
  | }

This is the EJb in the jar file:

@Stateless
  | 
  | public class EJBClient implements EJBClientItf {
  | 	
  | 	
  | 	@WebServiceRef(POJOWs.class)  
  | 	private POJOWs service;
  | 
  | 	public String callWS(String input) {
  | 	 
  | 	System.out.println("EJB called !"); 
  | 	return service.echo(input);  
  | 	 
  | 	
  | 	}
  | }

Now when I try to lookup my EJb and invoke the method callWS :

<%
  |             InitialContext ctx = new InitialContext();
  | 	    com.sample.EJBClientItf ejb = null;
  | 	    ejb = ( com.sample.EJBClientItf)ctx.lookup("StatelessfulExample/EJBClient/remote");
  | 	    String ss = ejb.callWS("hello");
  | 	    out.println(ss);
  | 
  | %>


Here's the error I get:

javax.ejb.EJBException: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.sample.EJBClient/service into property com.sample.EJBClient.service: WebServiceRef type 'class com.sample.POJOWs' is not assignable to javax.xml.ws.Service

How can I fix it ?
thanks a lot
john

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186444#4186444

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186444



More information about the jboss-user mailing list