31.3 Resource Web Service Examples

This section provides examples of using the Resource Web Service.

31.3.1 Code Map Synchronization Code Samples

This section provides code samples for using the SOAP endpoints for code map synchronization.

public IRemoteResource stub;
stub=getResourcesStub(url,adminname,password);
 

//refreshCodeMap
EntitlementRefreshInfo refreshResult = stub.refreshCodeMap("cn=Devices,cn=DevicesLoopback,cn=driverset1,o=system");
System.out.println(refreshResult .getDetailedStatus());
System.out.println(refreshResult .getEntitlementDN());
System.out.println(refreshResult .getGuid());
System.out.println(refreshResult .getStatus());
 

//getRefreshStatus 
CodeMapRefreshStatus[] refreshStatus =stub.getRefreshStatus("cn=Devices,cn=DevicesLoopback,cn=driverset1,o=system");
for (CodeMapRefreshStatus item : refreshStatus) {
           System.out.println("Connection Name is: " + item.getConnectionName());
               System.out.println("Entitlement DN is: " + item.getEntitlementDN());
               System.out.println("Entitlement GUID is: " + item.getGuid());
               System.out.println("Last Refresh of this Entitlement is: " + item.getLastRefresh());
               System.out.println("Status is: " + item.getStatus());
           }
 

//checkCodeMapValueStatus 
String connectionName="SAP123";
CodeMapValueStatus checkStatus = 
String codeMapValue=null;
 
stub.checkCodeMapValueStatus("cn=Devices,cn=DevicesLoopback,cn=driverset1,o=system",connectionName, codeMapValue);
   
     System.out.println("Connection Name is: " + checkStatus.getRefreshStatus().getConnectionName());
            System.out.println("Entitlement DN is: " + checkStatus.getRefreshStatus().getEntitlementDN());
            System.out.println("Entitlement GUID is: " + checkStatus.getRefreshStatus().getGuid());
            System.out.println("Last Refresh of this Entitlement is: " + checkStatus.getRefreshStatus().getLastRefresh());
            System.out.println("Status is: " + checkStatus.getRefreshStatus().getStatus());
            
            System.out.println(checkStatus.getUpToDate());
            System.out.println(checkStatus.getValue());
            
 
 
 

private static IRemoteResource getResourcesStub(String url,
    String username, String password) throws ServiceException {
         Stub stub = null;
 
         
         ResourceService service = new ResourceServiceImpl();
         stub = (Stub) service.getIRemoteResourcePort();
         stub._setProperty(Stub.USERNAME_PROPERTY, username);
         stub._setProperty(Stub.PASSWORD_PROPERTY, password);
         
         stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,url +"/resource/service");
         stub._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);            
     
         return (IRemoteResource) stub;
 }