try
{
Context encCtx = container.getEnc();
EJBContainer ejbContainer = (EJBContainer)container;
DeploymentUnit unit = ejbContainer.getDeploymentUnit();
URL rootURL = unit.getUrl();
ClassLoader loader = unit.getClassLoader();
URLLoaderAdapter vfsRoot = new URLLoaderAdapter(rootURL);
new ServiceRefDelegate().bindServiceRef(encCtx, name, vfsRoot, loader, sref);
log.debug("@WebServiceRef bound [env=" + name + "]");
}
catch (Exception e)
{
throw new WebServiceException("Unable to bind @WebServiceRef [enc=" + name + "]", e);
}