2.5 Client Stubs

A stub is a proxy on the client. The stub code performs SOAP calls to the server. Vibe provides pregenerated Java stub classes that are included in the Kablink Vibe Web Services Java client library. To obtain the Kablink Vibe Web Services Java client library, see Working with Java Objects.

The following example is the deleteFolderEntry method defined in the sample Java class TeamingServiceClientWithStub.java file. The TeamingServiceClientWithStub.java file makes SOAP calls to Vibe through the use of the pregenerated Java stub classes. This method uses the folder_deleteEntry Web services operation to delete an entry from Vibe. This code assumes that your client is running on the same machine that is running the Vibe server (localhost). It uses the Basic Authentication mechanism for authentication.

  private static final String TEAMING_SERVICE_ADDRESS_BASIC   = "http://localhost:8080/ssr/secure/ws/TeamingServiceV1";
  
  private static final String USERNAME = "admin";
  private static final String PASSWORD = "test";
      .
      .
      .
  public static void deleteFolderEntry(long entryId) throws Exception {
    TeamingServiceSoapServiceLocator locator = new TeamingServiceSoapServiceLocator();
    locator.setTeamingServiceEndpointAddress(TEAMING_SERVICE_ADDRESS_BASIC);
    TeamingServiceSoapBindingStub stub = (TeamingServiceSoapBindingStub) locator.getTeamingService();
    WebServiceClientUtil.setUserCredentialBasicAuth(stub, USERNAME, PASSWORD);

    stub.folder_deleteEntry(null, entryId);
    
    System.out.println("ID of the deleted entry: " + entryId);
  }