Associating device profile to a end user

Version 1
    This document was generated from CDN thread

    Created by: Jeff Jaggernauth on 28-04-2012 03:48:14 PM
    Hello, I am new to the forum, I have successfully added a device profile, however I am not able to associate it to an existing user. Any sample java code or steps to perform this task would be very much  appreciated.

    Subject: RE: Associating device profile to a end user
    Replied by: Bilge Cetin on 29-04-2012 03:20:14 PM
    If you use wsdl and java, here is how I do it:
    private static void updateUser(String userid,String dn, String profilename)
    {
     
     
     
      UpdateUserReq updateUserReq= new UpdateUserReq();
            UpdateUserReqPrimaryExtension primaryExtension=new UpdateUserReqPrimaryExtension();
            primaryExtension.setPattern(dn);
            primaryExtension.setRoutePartitionName("PT-System");
      updateUserReq.setPrimaryExtension(primaryExtension);
      UpdateUserReqPhoneProfiles phoneProfiles=new UpdateUserReqPhoneProfiles();
      String[] profileName=new String[1];
      profileName[0]=profilename;
      phoneProfiles.setProfileName(profileName);
      updateUserReq.setPhoneProfiles(phoneProfiles);
      updateUserReq.setUserid(userid);
     
           
            try {
      
       StandardResponse r = stub.updateUser(updateUserReq);
       System.out.println ("Result: " + r.get_return());
      
      } catch (Exception err) {
       System.out.println("Fault: "+err.getMessage());
      
      
      }
    }

    Subject: RE: Associating device profile to a end user
    Replied by: Jeff Jaggernauth on 30-04-2012 05:30:14 PM
    Hello. Thanks very much for the code, it worked, saved us lots of time. Best regards.