Quick Start (SwaRef): Create Content Services Spaces using the web service API (Deprecated)

The following Java code example creates a new space named New Directory located in Company Home. The identification value of the new space is written to the console. (See Creating Content Services (deprecated) Spaces.)

/** 
    * Ensure that you create Java proxy files that consume 
    * the DocumentManagement WSDL. You can use JAX-WS to create 
    * the proxy Java files.   
    *    
    * For information, see "Invoking LiveCycle using SwaRef" in Programming with LiveCycle.   
    */ 
 
import javax.xml.ws.BindingProvider; 
import com.adobe.idp.services.*; 
 
public class CreateSpaceSwaRef { 
 
    public static void main(String[] args) 
        { 
         try{ 
           String url = "http://localhost:8080/soap/services/DocumentManagementService?blob=swaref"; 
           String username = "administrator"; 
           String password = "password"; 
 
          //Create a  DocumentManagementService instance 
           DocumentManagementServiceService myDMServiceInterface = new DocumentManagementServiceService(); 
           DocumentManagementService documentManagement = myDMServiceInterface.getDocumentManagementService(); 
 
     ((BindingProvider)documentManagement).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 
     ((BindingProvider)documentManagement).getRequestContext().put(javax.xml.ws.BindingProvider.USERNAME_PROPERTY, username); 
     ((BindingProvider)documentManagement).getRequestContext().put(javax.xml.ws.BindingProvider.PASSWORD_PROPERTY, password); 
 
           //Specify the name of the store and node 
        String storeName ="SpacesStore";  
        String nodeName = "/Company Home/Test Directory" ; 
                             
        //Create a new space 
        String spaceId = documentManagement.createSpace(storeName,nodeName); 
        System.out.println("The identifier value of the new space is " +spaceId); 
 
         }catch (Exception e) { 
               e.printStackTrace(); 
             }      
          } 
     }

// Ethnio survey code removed