HostedActiveDirectory Web Service - CreateUserRequestData Help

Last post 06-03-2009 3:56 PM by tsch. 6 replies.

Sort Posts:

  • HostedActiveDirectory Web Service - CreateUserRequestData Help

    09-25-2008, 2:38 PM
    • Member
      14 point Member
    • larswise
    • Member since 06-12-2007, 8:42 AM
    • Posts 27

    I am trying to create a user with the new web services in HMC4.5, basically it works fine, but when i try to instantiate and set values in the CreateUserRequestData.properties object, it fails.

    What i want to do is to, in addition to set the basic data like upn, display, givenname, lastname etc, also set the mobile property in Active Directory...
    My request looks like this:

    MPSWSProxy.HostedActiveDirectory.Service ads = new MPSWSProxy.HostedActiveDirectory.Service();
    ads.Credentials =
    this.Credentials();

    //
    // Create user request object
    //

    MPSWSProxy.HostedActiveDirectory.CreateUserRequest cuReq = new MPSWSProxy.HostedActiveDirectory.CreateUserRequest();
    //
    // Create user request data object
    //

    MPSWSProxy.HostedActiveDirectory.CreateUserRequestData cuReqData = new MPSWSProxy.HostedActiveDirectory.CreateUserRequestData();
    cuReqData.container = mclsOrg.AdsPath;
    cuReqData.displayName = txtFirstName.Text.Trim() +
    " " + txtMiddle.Text.Trim() + " " + txtLastName.Text.Trim();
    cuReqData.givenName = txtFirstName.Text.Trim();
    cuReqData.sn = txtLastName.Text.Trim();
    cuReqData.userPrincipalName = txtUserName.Text.Trim();
    cuReqData.preferredDomainController =
    ArcNGMain.KEY_PDC;

    MPSWSProxy.HostedActiveDirectory.ArrayOfCreateUserRequestDataPropertyProperty prop = new MPSWSProxy.HostedActiveDirectory.ArrayOfCreateUserRequestDataPropertyProperty();
    prop.name =
    "mobile"; prop.value[0] = txtMobile.Text;
    cuReqData.properties[0] = prop;

    The last line fails with an exception, "object reference not set to an instance......" use the new keyword...

    Can anyone tell me how to handle this object to set active directory attributes?

    Thanks !

  • Re: HostedActiveDirectory Web Service - CreateUserRequestData Help

    09-25-2008, 8:53 PM
    • Member
      14 point Member
    • larswise
    • Member since 06-12-2007, 8:42 AM
    • Posts 27
    When doing it like this, i get a little further:

    cuReqData.properties = new MPSWSProxy.HostedActiveDirectory.ArrayOfCreateUserRequestDataPropertyProperty[1];
    cuReqData.properties[0] =
    new MPSWSProxy.HostedActiveDirectory.ArrayOfCreateUserRequestDataPropertyProperty();
    cuReqData.properties[0].value =
    new object[] { txtMobile.Text.Trim() };
    cuReqData.properties[0].name =
    "mobile";
    cuReqData.properties[0].mode = MPSWSProxy.HostedActiveDirectory.
    ArrayOfCreateUserRequestDataPropertyPropertyMode.update;

    However, now i get a new error:

    ---------------------------
    An Error Occurred
    ---------------------------
    Server was unable to process request. ---> The value 'xsd:string' is invalid according to its schema type 'QName' - 'xsd' is an undeclared namespace.    ***Xml input provided to this method:***    <executeXml><context><securityContext trustee="TESTDOM\IMPS20_TESTPROV01" impersonate="1" /><transactionContext transactionId="{957631BA-ED7F-4D6B-88D6-A02B77A5CCF7}" /><executeContext procedure="Create Object" procedureExecId="56" providerSource="Microsoft.Provisioning.Providers.ActiveDirectoryProvider" namespace="Active Directory Provider" type="write" /></context><executeData><name>cn=test.aa.bb@alpineskihouse.com</name><container>LDAP://TESTAD01.testdom.local/OU=ConsolidatedMessenger,OU=Hosting,DC=testdom,DC=local</container><class>user</class><properties><property name="sAMAccountName">test.aa.bb_alpineski</property><property name="userPrincipalName">test.aa.bb@alpineskihouse.com</property><property name="mobile"><value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+5511112222</value></property><property name="displayNam... --->

    if you look at the property tag for "mobile" it looks like this: <property name="mobile"><value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+5511112222</value>

    In traceview it looks like this:

    data node -<data>
     <container>LDAP://OU=ConsolidatedMessenger,OU=Hosting,DC=testdomain,DC=local</container>
     <userPrincipalName>test.cc@alpineskihouse.com</userPrincipalName>
     <preferredDomainController>testad01.testdomain.local</preferredDomainController>
     <displayName>test cc</displayName>
     <givenName>test</givenName>
     <sn>cc</sn>
     <initials>t c</initials>
     <description>ConsolidatedMessenger User</description>
     <newPassword>Qwertyu222</newPassword>
    -<properties>
    -<property name="mobile">
     <value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3333333333</value>
     </property>
     </properties>
     </data>

    ........ Any help is appreciated......

  • Re: HostedActiveDirectory Web Service - CreateUserRequestData Help

    09-27-2008, 4:14 AM
    • Member
      14 point Member
    • larswise
    • Member since 06-12-2007, 8:42 AM
    • Posts 27

    Any ideas why the property tag i make via the ArrayOfCreateUserPropertyProperty object is being rendered like this?

    <property name="mobile"><value xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+5511112222</value>

  • Re: HostedActiveDirectory Web Service - CreateUserRequestData Help

    10-20-2008, 5:36 PM
    • Member
      14 point Member
    • larswise
    • Member since 06-12-2007, 8:42 AM
    • Posts 27

    I am having this problem also in the HostedActiveDirectory.Service.ModifyUser method:

    +  $exception {"Server was unable to process request. ---> The value 'xsd:string' is invalid according to its schema type 'QName' - 'xsd' is an undeclared namespace.    ***Xml input provided to this method:***    <executeXml><context><securityContext trustee=\"testdomain\\IMPS20_provtest0101\" impersonate=\"1\" /><transactionContext transactionId=\"{D340C30F-9DC0-4406-A1D0-1140A295B2D1}\" /><executeContext procedure=\"Set Properties\" procedureExecId=\"5\" providerSource=\"Microsoft.Provisioning.Providers.ActiveDirectoryProvider\" namespace=\"Active Directory Provider\" type=\"write\" /></context><executeData><path>LDAP://TESTAD01.testdomain.local/CN=demo.1@testreseller1.com,OU=TestReseller,OU=ConsolidatedMessenger,OU=Hosting,DC=testdomain,DC=local</path><properties><property name=\"scriptPath\" mode=\"update\"><value xsi:type=\"xsd:string\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">iuyuiyuiyuiy</value></property><property name=\"streetAddress\" mode=\"update\"><value xsi:type=\"xsd:string\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">iuyuiyui</value></property></properties></execu... ---> <response><errorContext description=\"The value 'xsd:string' is invalid according to its schema type 'QName' - 'xsd' is an undeclared namespace.    ***Xml input provided to this method:***    &lt;executeXml&gt;&lt;context&gt;&lt;securityContext trustee=&quot;testdomain\\IMPS20_provtest0101&quot; impersonate=&quot;1&quot; /&gt;&lt;transactionContext transactionId=&quot;{D340C30F-9DC0-4406-A1D0-1140A295B2D1}&quot; /&gt;&lt;executeContext procedure=&quot;Set Properties&quot; procedureExecId=&quot;5&quot; providerSource=&quot;Microsoft.Provisioning.Providers.ActiveDirectoryProvider&quot; namespace=&quot;Active Directory Provider&quot; type=&quot;write&quot; /&gt;&lt;/context&gt;&lt;executeData&gt;&lt;path&gt;LDAP://TESTAD01.testdomain.local/CN=demo.1@testreseller1.com,OU=TestReseller,OU=ConsolidatedMessenger,OU=Hosting,DC=testdomain,DC=local&lt;/path&gt;&lt;properties&gt;&lt;property name=&quot;scriptPath&quot; mode=&quot;update&quot;&gt;&lt;value xsi:type=&quot;xsd:string&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;iuyuiyuiyuiy&lt;/value&gt;&lt;/property&gt;&lt;property name=&quot;streetAddress&quot; mode=&quot;update&quot;&gt;&lt;value xsi:type=&quot;xsd:string&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;iuyuiyui&lt;/value&gt;&lt;/property&gt;&lt;/properties&gt;&lt;/execu...\" code=\"0x80131941\" executeSeqNo=\"5\"><errorSource namespace=\"Active Directory Provider\" procedure=\"Set Properties\"/><errorSource namespace=\"Preferred DC Active Directory Provider\" procedure=\"Set Properties\"/><errorSource namespace=\"Managed Active Directory\" procedure=\"ModifyUser\"/><errorSource namespace=\"Hosted Active Directory\" procedure=\"ModifyUser\"/></errorContext></response>"} System.Exception {System.Web.Services.Protocols.SoapException}

    If anyone else have this problem, please let me know

  • Re: HostedActiveDirectory Web Service - CreateUserRequestData Help

    10-22-2008, 9:01 AM
    Answer
    • Member
      14 point Member
    • larswise
    • Member since 06-12-2007, 8:42 AM
    • Posts 27

    Appears to be a solution..:

     Went into Reference.cs under HostedActiveDirectory in the web service proxy project:

    /// <remarks/>

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.1433")]

    [System.SerializableAttribute()]

    [System.Diagnostics.DebuggerStepThroughAttribute()]

    [System.ComponentModel.DesignerCategoryAttribute("code")]

    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://provisioning.microsoft.com/hostedactivedirectory")]public partial class ArrayOfModifyUserRequestDataPropertyProperty {

     

    private string valueField;

     

    private string nameField;

     

    private ArrayOfModifyUserRequestDataPropertyPropertyMode modeField;

     

    private bool modeFieldSpecified;

     

    /// <remarks/>

    [System.Xml.Serialization.XmlElementAttribute("value")]

    public string value {

    get {return this.valueField;

    }

    set {

    this.valueField = value;

    }

    }

     

    valueField WAS an object[] - changed to string...... seems to work :)

  • Re: HostedActiveDirectory Web Service - CreateUserRequestData Help

    05-29-2009, 3:23 PM
    • Member
      26 point Member
    • tsch
    • Member since 05-26-2009, 2:34 PM
    • Auburn Hills, MI
    • Posts 20

    I am running into this, too, calling ...Service.CreateUser(). Is there a fix other than editing Reference.cs under HostedActiveDirectory in the web service proxy project?

    --------------------
    Tom Schulte
    Senior System Engineer
    Plex Systems, Inc.
    http://www.plex.com
  • Re: HostedActiveDirectory Web Service - CreateUserRequestData Help

    06-03-2009, 3:56 PM
    • Member
      26 point Member
    • tsch
    • Member since 05-26-2009, 2:34 PM
    • Auburn Hills, MI
    • Posts 20

    This solution is working for me. However, anyone using the Update Web Reference feature, for any reason, will lose the relevant changes. Microsoft should provide and explanation, or permanent fix applied to the MPS server where the Service originates.

    --------------------
    Tom Schulte
    Senior System Engineer
    Plex Systems, Inc.
    http://www.plex.com
Page 1 of 1 (7 items)