-
Notifications
You must be signed in to change notification settings - Fork 612
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
// Create a BIMserver client, this uses a convenience method that logs in as [email protected]/admin, just copy/paste the code of setupJson and change to your needs
BimServerClientInterface bimServerClient = LocalDevSetup.setupSoap("http://localhost:8080");
// List project names
for (SProject project : bimServerClient .getBimsie1ServiceInterface().getAllProjects(true, true)) {
System.out.println(project.getName());
}
Connecting with JSON and checking in a file:
// Create a BIMserver client, this uses a convenience method that logs in as [email protected]/admin, just copy/paste the code of setupJson and change to your needs
BimServerClientInterface bimServerClient = LocalDevSetup.setupJson("http://localhost:8080");
// Create a new project
SProject newProject = bimServerClient.getBimsie1ServiceInterface().addProject("New project name");
// This is the file we will be checking in
File ifcFile = new File("location of the file you want to checkin");
// Find a deserializer to use
SDeserializerPluginConfiguration deserializer = bimServerClient.getBimsie1ServiceInterface().getSuggestedDeserializerForExtension("ifc");
// Checkin
bimServerClient.checkin(newProject.getOid(), "test", deserializer.getOid(), false, true, ifcFile);
Connect via JSON and Download a revision as IFC
// Create a BIMserver client, this uses a convenience method that logs in as [email protected]/admin, just copy/paste the code of setupJson and change to your needs
BimServerClientInterface bimServerClient = LocalDevSetup.setupJson("http://localhost:8080");
// Find a serializer
SSerializerPluginConfiguration serializer = bimServerClient.getBimsie1ServiceInterface().getSerializerByContentType("application/ifc");
// Get the project details
SProject project = bimServerClient.getBimsie1ServiceInterface().getProjectByPoid([INSERT OID OF YOUR PROJECT]);
// Download the latest revision
Long downloadId = bimServerClient.getBimsie1ServiceInterface().download(project.getLastRevisionId(), colladaSerializer.getOid(), true, false); // Note: sync: false
InputStream downloadData = bimServerClient.getDownloadData(downloadId, serializer .getOid());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(downloadData, baos);
System.out.println(baos.size() + " bytes downloaded");
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 1.3
- 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