Object xUrlResolver = xLocalServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", xContext );
XUnoUrlResolver urlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface( XUnoUrlResolver.class, xUrlResolver );
Object rInitialObject = urlResolver.resolve( "uno:" + sConnection + ";urp;StarOffice.NamingService" );
XNamingService rName = (XNamingService)UnoRuntime.queryInterface(XNamingService.class, rInitialObject );
XMultiServiceFactory xFactory = null;
if( rName != null )
{
Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager" );
xFactory = (XMultiServiceFactory)
UnoRuntime.queryInterface( XMultiServiceFactory.class, rXsmgr );
}
return xFactory;
}