[JBossWS] - EJB client for a Web service
by freejohn22
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
16 years, 1 month
[JBossWS] - How to access webservice
by majeric
Hi,
I'm new at webservices and have been searching for solution but couldn't find this specific problem anywhere. I'm pretty sure that I'm not the first one with this problem, but anyway.
I have a webservice that works fine on my local machine. I access to it with URL: http://127.0.0.1:8081/taskws/TaskService?wsdl
Web services looks like this:
@Stateless
| @WebContext(contextRoot="/taskws")
| @WebService(name = "TaskService", serviceName = "TaskService")
| public class TaskService implements TaskServiceRemote {
| //...
| }
But problem appears when I deploy on my server. I can't acces my web services there. I have an application instaled like this:
in application.xml:
<context-root>/<context-root>
in jboss-web:
<jboss-web>
| ...
| <virtual-host>test</virtual-host>
| <context-root>/</context-root>
| </jboss-web>
and in server.xml: a have a host:
<Host name="test" autoDeploy="false" deployOnStartup="false" deployXML="false">
| <Alias>test.domain.com</Alias>
| ...
| </Host>
Jboss runs on localhost and I access to jboss via apache mod_jk.
How do I have to configure to have access to this service.
application works fine if I access test.domain.com.
I appriciate your help.
Uros
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186166#4186166
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186166
16 years, 1 month