try
{
// Get the deployment model factory
SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
DeploymentModelFactory depModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
// Create/Setup the deployment
Deployment deployment = depModelFactory.newDeployment("endpoint-deployment", implClass.getClassLoader());
deployment.setRuntimeClassLoader(deployment.getInitialClassLoader());
// Create/Setup the service
Service service = deployment.getService();
service.setContextRoot(contextRoot);
// Create/Setup the endpoint
org.jboss.wsf.spi.deployment.Endpoint ep = depModelFactory.newEndpoint(implClass.getName());
service.addEndpoint(ep);
// Deploy using deployment aspects
getDeploymentAspectManager().deploy(deployment);
deployments.put(contextRoot, deployment);