[JBossWS] - webservice class injecting EJB, nullpointerexception
by HTroeng
Shouldn't it be possible to inject an EJB into a jax-ws webservice class? I get a nullpointerexception when trying to use the EJB, it doesn't look like the ejb is injected into the webservice class?
Code:
Interface:
@WebService
public interface MyService {
public String echoService(String input);
}
Implementation:
@WebService(endpointInterface = "my.package.MyService")
@SOAPBinding(style = Style.RPC)
public class MyServiceImpl implements MyService {
@EJB
SurveillanceService surveillanceService;
@WebMethod(operationName="echoService")
public String echoService(String input) {
boolean isAvail = surveillanceService.isDatabaseAvailable();
return "Hi " + input + ", result from ejb: " + isAvail;
}
}
The EJB does work (confirmed, I use it in other places), It seems that it is something with the Webservice > EJB...
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119706#4119706
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119706
18 years, 3 months
[JBoss Seam] - Re: Keep Trinidad table sort order
by brachie
Hi Pete,
thanks for the answer. I do not fully unterstand how to do what you suggested.
What I am doing is:
Conversational SFSB
| @DataModel
| private List<Mitarbeiter> mitarbeiters;
| ...
|
| @Factory(value = "mitarbeiters")
| public void getMitarbeiterList() {
| Criteria c = ((HibernateSessionProxy) entityManager.getDelegate())
| .createCriteria(Mitarbeiter.class);
| c.addOrder(Order.desc("nachname"));
| mitarbeiters = c.list();
| }
|
and in my template:
| <tr:table width="290px" value="#{mitarbeiters}" var="mitarbeiter" rows="5" styleClass="trTableDiv">
| <tr:column sortable="true" sortProperty="login">
| <f:facet name="header">Login</f:facet>
| <s:link value="#{mitarbeiter.login}" propagation="new"
| action="#{mitarbeiterMgr.selectMitarbeiter}">
| <f:param name="mitarbeiterId" value="#{mitarbeiter.id}" />
| </s:link>
| </tr:column>
| ...
| </tr:table>
|
After clicking the link the same page loads again with the details of mitarbeiter, but the sort order of the table is gone.
Ho do I access the EntityQuery or place the Criteria in another scope?
Alexander
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119702#4119702
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119702
18 years, 3 months
[JBossWS] - Re: WSSE UsernameToken without HTTP basic auth?
by mikaeljl
So, adding:
reqContext.put(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE);
|
to the client side removed the http auth header.
Guess this is because the org.jboss.ws.core.client.RemotingConnectionImpl-createRemotingMetaData method is called before the WSSecurityDispatcher calls ctx.put(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE); ? By setting this property from the client this is avoided.
The problem now is that I can no longer the the login to work properly on the server side.
What should I put in web.xml ? I've tried with
<security-constraint>
| <web-resource-collection>
| <web-resource-name>ProtectedResource</web-resource-name>
| <url-pattern>/*</url-pattern>
| </web-resource-collection>
| <auth-constraint>
| <role-name>friend</role-name>
| </auth-constraint>
| </security-constraint>
| <!-- We do not want http basic authentication
| <login-config>
| <auth-method>BASIC</auth-method>
| <realm-name>JBossWS</realm-name>
| </login-config>
| -->
| <security-role>
| <role-name>friend</role-name>
| </security-role>
|
But that results in the application not being authorized, I've tried to remove the security-constraint but then I can no longer retrieve the current principal information from within my WS implementation...
I've tried to retrieve it using:
Subject caller = (Subject) PolicyContext.getContext(SUBJECT_CONTEXT_KEY);
|
and:
@Resource
| javax.xml.ws.WebServiceContext wsCtx;
| java.security.Principal principal = wsCtx.getUserPrincipal();
But both return null data.
How should I retrive the principal data when using wsse usernametoken?
I can see in the traces that the security information is picked up:
2008-01-14 16:54:37,113 TRACE [org.jboss.security.SecurityAssociation] getSubject, sc=org.jboss.security.SecurityAssociation$SubjectContext@1b6c763{principal=kermit,subject=null}
But how to retrieve it?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119700#4119700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119700
18 years, 3 months