1.6 Client Stubs

A stub is a proxy on the client. The stub code performs SOAP calls to the server. Teaming provides pre-generated Java stub classes that are included in the Kablink Teaming Web Services Java client library. To obtain the Kablink Teaming Web Services Java client library, see Section 1.7.1, 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 Teaming through the use of the pre-generated Java stub classes mentioned above. This method uses the folder_deleteEntry Web services operation to delete an entry from Teaming. This code assumes that your client is running on the same machine that is running the Teaming server (localhost). It uses the Basic Authentication mechanism for authentication.

Consider the following code:

  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);
  }