[JBossWS] - Re: error using wsprovide
by Fantagir
HI!
I've solved the error before. I execute the wsprovide in the build directory instead of the build\service directory and change the command like this:
$c:\jboss\wsprovide -t -o generated -w service. IContar service.Contar
But know I've got another error:
java.lang.NoClassDefFoundError: javax/ejb/Stateless
I don't implement EJB. This could be the problem?
I put here the code of my classes:
IContar
package service;
|
| import java.rmi.Remote;
| import java.rmi.RemoteException;
|
| import javax.jws.WebMethod;
| import javax.jws.WebResult;
| import javax.jws.WebService;
| import javax.jws.WebParam;
|
| import org.osid.OsidContext;
|
| import util.DatePalabra;
|
| @WebService(
| name="IContar", // wsdl:portType
| targetNamespace="urn:service" //wsdl:targetNamespace
| )
| public interface IContar extends Remote {
|
| @WebMethod
| @WebResult(name="IContar_darCuentaResponse")
| public DatePalabra darCuenta(@WebParam(name = "ctx", partName ="ctx") OsidContext ctx) throws RemoteException;
| }
|
|
Contar
package service;
import java.rmi.RemoteException;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import org.osid.OsidContext;
import org.osid.OsidException;
import util.DatePalabra;
@WebService(
serviceName="Contar", // wsdl:service
portName= "IContarPort", //wsdl:port name=... binding=...
endpointInterface = "service.IContar", //nombre de la interficie del WebService
targetNamespace="urn:service", //wsdl:targetNamespace
wsdlLocation = "WEB-INF/wsdl/Contar.wsdl" //nombre y ubicación en el proyecto del fichero .wsdl
)
@SOAPBinding(
style=SOAPBinding.Style.RPC,
use=SOAPBinding.Use.LITERAL
)
public class Contar implements IContar{
public DatePalabra darCuenta(OsidContext ctx) throws RemoteException {
DatePalabra dp = new DatePalabra();
try {
String str = (String) ctx.getContext("iduser");
dp.setPalabra(str);
dp.setLongitud(Integer.toString(str.length()));
return dp;
} catch (OsidException e) {
// TODO Auto-generated catch block
e.printStackTrace();
dp.setLongitud("0");
dp.setPalabra("vacio");
return dp;
}
}
}
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093032#4093032
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093032
17 years
[JBossWS] - Re: WS-Security: keystores and truststores
by cavani
Hi,
I am using the follow approach based on JBossWS 2.0.1:
1. I didn't change distribution code
2. Copy to my project (EJB where WS is configured):
org.jboss.ws.extensions.security.jaxws.WSSecurityHandler
org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer
org.jboss.ws.extensions.security.WSSecurityDispatcher
3. Merge WSSecurityHandler and WSSecurityHandlerServer in a single source (WSSecurityHandler no more abstract and delete Server) and change invocation to my WSSecurityDispatcher copy.
4. Create my own SecurityStore extending org.jboss.ws.extensions.security.SecurityStore:
| public class SecurityStore extends org.jboss.ws.extensions.security.SecurityStore
| {
|
| private KeyStore keyStore;
|
| private KeyStore trustStore;
|
| private char[] keyStorePassword;
|
| public SecurityStore() throws WSSecurityException
| {
| loadKeyStore();
|
| SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
| SecurityAdaptorFactory secAdapterfactory = spiProvider.getSPI(SecurityAdaptorFactory.class);
| SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter();
|
| String username = securityAdaptor.getPrincipal().toString();
|
| loadSessionKey(username);
| }
|
| public SecurityStore(Element element) throws WSSecurityException
| {
| loadKeyStore();
|
| Element child = Util.getFirstChildElement(element);
|
| String username = null;
|
| while (child != null)
| {
| String tag = child.getLocalName();
|
| if (tag.equals("UsernameToken"))
| {
| UsernameToken token = new UsernameToken(child);
| username = token.getUsername();
| break;
| }
|
| child = Util.getNextSiblingElement(child);
| }
|
| loadSessionKey(username);
| }
|
| // copy of public methods from SecurityStore
|
|
where:
* loadKeyStore() load server key/certificate
* loadSessionKey(String username); load user certificate (all certificate has the same alias)
4. Change WSSecurityDispatcher to instantiate my SecurityStore copy:
* Element parameter Constructor at handleInbound
* Default Constructor at handleOutbound
5. use my WSSecurityHandler at standard-jaxws-endpoint-config.xml
6. configure client with username tag at jboss-wsse-client.xml and:
| BindingProvider bindingProvider = (BindingProvider) port;
| Map<String, Object> reqContext = bindingProvider.getRequestContext();
| reqContext.put(BindingProvider.USERNAME_PROPERTY, (String) USERNAME_HERE);
| reqContext.put(BindingProvider.PASSWORD_PROPERTY, "");
|
just it!
it is working fine to me (user certs are in LDAP acounts accessed with JNDI - InitialDirContext).
Any changes to improve security code to implement something like this out-of-box (like pluggable SecurityStore with username information)? for 2.0.2?
Thanks,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092995#4092995
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092995
17 years