-
Notifications
You must be signed in to change notification settings - Fork 617
BimServerClient
To connect to a BIMserver you can use one of the 3 protocols: SOAP, [JSON](JSON API) or [Protocol Buffers](Protocol Buffers). To make connecting to a BIMserver even easier, there also is a Java library you can use.
You can download a recent release from https://github.com/opensourceBIM/BIMserver/releases, and then the file named "bimserver-client-lib-[date].zip". Make sure it matches with your BIMserver version.
Extract the zipfile, copy the jar files from the "lib" and "dep" folders to your own project and include them in the build path.
Of course you can also use the client from source code, in that case download a source zip file, or checkout the projects from GIT.
Connecting via SOAP with authentication, and listing all projects
import java.io.File;
import java.util.List;
import org.bimserver.LocalDevPluginLoader;
import org.bimserver.client.json.JsonBimServerClientFactory;
import org.bimserver.emf.IfcModelInterface;
import org.bimserver.emf.MetaDataManager;
import org.bimserver.interfaces.objects.SProject;
import org.bimserver.plugins.PluginException;
import org.bimserver.plugins.PluginManager;
import org.bimserver.plugins.services.BimServerClientException;
import org.bimserver.plugins.services.BimServerClientInterface;
import org.bimserver.shared.BimServerClientFactory;
import org.bimserver.shared.ChannelConnectionException;
import org.bimserver.shared.PublicInterfaceNotFoundException;
import org.bimserver.shared.UsernamePasswordAuthenticationInfo;
import org.bimserver.shared.exceptions.ServiceException;
/**
* @author Ruben de Laat
*
* This example shows how to connect to a remote BIMserver, using the bimserver-client-download (a bunch of JAR files you have to link in your IDE)
* Make sure you actually link the JAR files in you IDE (in eclipse add to build-path), otherwise the PluginManager won't find certain plugins
*
*/
public class ClientLibDownloadExample {
public static void main(String[] args) {
try {
// Client-side, we also use a PluginManager, for example to be able to use the (IFC) schemas
PluginManager pluginManager = LocalDevPluginLoader.createPluginManager(new File("home"));
// Create a MetaDataManager, and initialize it, this code will be simplified/hidden in the future
MetaDataManager metaDataManager = new MetaDataManager(pluginManager);
pluginManager.setMetaDataManager(metaDataManager);
metaDataManager.init();
// Initialize all loaded plugins
pluginManager.initAllLoadedPlugins();
// Create a factory for BimServerClients, connnect via JSON in this case
BimServerClientFactory factory = new JsonBimServerClientFactory(metaDataManager, "http://localhost:8080");
// Create a new client, with given authorization, replace this with your credentials
BimServerClientInterface client = factory.create(new UsernamePasswordAuthenticationInfo("[email protected]", "admin"));
// Example code assuming at least 1 project in your BIMserver
List<SProject> projects = client.getBimsie1ServiceInterface().getAllProjects(true, true);
SProject project = projects.get(0);
// Load a model
IfcModelInterface model = client.getModel(project, project.getLastRevisionId(), false, false);
} catch (PluginException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
} catch (ChannelConnectionException e) {
e.printStackTrace();
} catch (BimServerClientException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
}
}
}
Examples on how to use the client-library can be found here.
Examples on how to use the client-side EMF model can be found here
Examples on how to use the low-level-calls from the client library are here
Get Started
- Quick Guide
- Requirements Version 1.2
- Requirements Version 1.3
- Requirements Version 1.4
- Requirements Version 1.4 > 2015-09-12
- Requirements Version 1.5
- Download
- JAR Starter
- Setup
Deployment
- Ubuntu installation
- Windows installation
- Security
- Memory Usage
- More memory
- Performance statistics
- Large databases
Developers
- Service Interfaces
- Common functions
- Data Model
- Low Level Calls
- Endpoints
Clients
BIMServer Developers
- Plugins in 1.5
- Plugin Development
- Eclipse
- Eclipse Modeling Framework
- Embedding
- Terminology
- Database/Versioning
- IFC STEP Encoding
- Communication
- Global changes in 1.5
- Writing a service
- Services/Notifications
- BIMserver 1.5 Developers
- Extended data
- Extended data schema
- Object IDM
New developments
- New remote service interface
- Plugins new
- Deprecated
- New query language
- Visual query language
- Reorganizing BIMserver JavaScript API
General