Topic
  • 25 replies
  • Latest Post - ‏2014-10-06T19:09:16Z by kenhygh
Datapower409
Datapower409
27 Posts

Pinned topic SOMA Script to Create a User??

‏2013-07-15T09:49:57Z |

Hi,

I am looking for a SOMA Script which will create a user for a specific domain with all(r+w+a+d+x) access, can any one help me on this?

And is there any SOMA  script is available that can give you list of all users in the domain(Not Active Users)??

Kindly help me on above ASAP...Tnx in Adv...

Regards,

Naren

 

  • David07
    David07
    73 Posts
    ACCEPTED ANSWER

    Re: SOMA Script to Create a User??

    ‏2013-07-16T09:05:14Z  

    Hi David,

    I am using SOAPUI to test this and am also providing proper HTTP Authorization header but am not sure y it's failing and i am using URL as below

    https://IP:5550/service/mgmt/current

     

    Regards,

    Naren

    HI,

    Your URL seems gud, but i think you are doing mistake while setting the Authorization header. In SOAPUI you want to pass authorization parameters in base64 encoded format.Otherwise try to use CURL editor, I think it ll help you.

    David 

  • HermannSW
    HermannSW
    4741 Posts
    ACCEPTED ANSWER

    Re: SOMA Script to Create a User??

    ‏2013-07-16T10:34:38Z  

    Hi David,

    I am using SOAPUI to test this and am also providing proper HTTP Authorization header but am not sure y it's failing and i am using URL as below

    https://IP:5550/service/mgmt/current

     

    Regards,

    Naren

    Hi Naren,

    I do use "doSoma" shell script (shown below) to not always having to remember the curl details.

    I only changed "admin" in your SOMA file to "admin3", as you can see the creation of user was successful:

    $ cat ~/bin/doSoma
    #!/bin/bash
    curl -k -u $1 --data-binary @$2 https://$3/service/mgmt/current $4
    $

    $ doSoma admin Naren.xml dp1-l3:5550 ; echo
    Enter host password for user 'admin':
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dp:response xmlns:dp="http://www.datapower.com/schemas/management"><dp:timestamp>2013-07-16T06:31:16-04:00</dp:timestamp><dp:result>OK</dp:result></dp:response></env:Body></env:Envelope>
    $
     

    Here are some postings on what you can do further with doSoma:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/tags/dosoma


    You might find this posting useful, which describes a simple method to get ALL sample SOMA requests:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/xml_management_sample_requests36


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • HermannSW
    HermannSW
    4741 Posts
    ACCEPTED ANSWER

    Re: SOMA Script to Create a User??

    ‏2013-07-16T11:36:28Z  

    Hi Herman,

    Thanks for replay, now am able to create user successfully could you please provide script for getting all users of the box,by using ActiveUsers class we only get active users details but i want entire box users.

    And also pls provide me script for deleting a user..tnx for your help

     

    Regards,

    Naren

    You create user with set-config, so you need get-config to query users.

    This gets the complete config:

    $ cat get-config.xml
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
      <env:Body>
        <dp:request domain="default"
          xmlns:dp="http://www.datapower.com/schemas/management">
          <dp:get-config/>
        </dp:request>
      </env:Body>
    </env:Envelope>
    $

    And this gets only the users:

    $ cat get-users.xml
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
      <env:Body>
        <dp:request domain="default"
          xmlns:dp="http://www.datapower.com/schemas/management">
          <dp:get-config class="User"/>
        </dp:request>
      </env:Body>
    </env:Envelope>
    $

    These are the options you have (from store:///xml-mgmt-ops.xsd"):

            <!-- get config -->
            <xsd:element name="get-config">
              <xsd:complexType>
                <xsd:attribute name="class" type="tns:ConfigEnum"/>
                <xsd:attribute name="name" type="xsd:string"/>
                <xsd:attribute name="recursive" type="xsd:boolean"/>
                <xsd:attribute name="persisted" type="xsd:boolean"/>
              </xsd:complexType>
            </xsd:element>

     

    I did just lookup "tns:ConfigEnum" in xml-mgmt.xsd to find that "User" is the @class entry needed.

    Please use del-config to delete stuff, the same way you used set-config.

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • David07
    David07
    73 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-15T11:10:14Z  

    Hi,

    Check with the below mentioned SOMA script to create user and to find the status of users,

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
    <env:Body>


    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
                <dp:set-config>
                    <User name="UserName">
                        <Password>StartingPassword</Password>
                        <GroupName>NewGroupName</GroupName>   //we will provide group name if access level is group defined
                        <AccessLevel>group-defined | priviliged | user</AccessLevel>
                    </User>
                </dp:set-config>
    </dp:request>

    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
               <dp:get-status class="ActiveUsers"/>
    </dp:request>

     

    <!--You want to save the datapower objects as you are saving in webgui, so this can be done by the following script-->

    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
    <dp:do-action>
    <SaveConfig/>
    </dp:do-action>
    </dp:request>


    </env:Body>
    </env:Envelope>

     

    David.

     

     

     

     

     

    Updated on 2013-07-15T11:11:41Z at 2013-07-15T11:11:41Z by David07
  • DPuser13
    DPuser13
    1 Post

    Re: SOMA Script to Create a User??

    ‏2013-07-15T11:17:05Z  

     

    HI,

    I did not use SOMA script for create user. Below link shows various examples of using SOMA.

    http://www.redbooks.ibm.com/redpapers/pdfs/redp4446.pdf

  • swlinn
    swlinn
    1348 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-15T13:09:56Z  
    • David07
    • ‏2013-07-15T11:10:14Z

    Hi,

    Check with the below mentioned SOMA script to create user and to find the status of users,

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
    <env:Body>


    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
                <dp:set-config>
                    <User name="UserName">
                        <Password>StartingPassword</Password>
                        <GroupName>NewGroupName</GroupName>   //we will provide group name if access level is group defined
                        <AccessLevel>group-defined | priviliged | user</AccessLevel>
                    </User>
                </dp:set-config>
    </dp:request>

    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
               <dp:get-status class="ActiveUsers"/>
    </dp:request>

     

    <!--You want to save the datapower objects as you are saving in webgui, so this can be done by the following script-->

    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
    <dp:do-action>
    <SaveConfig/>
    </dp:do-action>
    </dp:request>


    </env:Body>
    </env:Envelope>

     

    David.

     

     

     

     

     

    Also, if you don't want the new user to have the password change prompt, you can have two copies of the <User> nodeset.  The second will be the equivalent to setting the password after the initial creation, so the user will not be prompted to change the password on initial signon.  I've done this for monitoring users that were issuing read only SOMA requests and would not normally sign on to the web-gui to change the password.

    Regards,

    Steve

  • Datapower409
    Datapower409
    27 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-16T04:42:32Z  
    • David07
    • ‏2013-07-15T11:10:14Z

    Hi,

    Check with the below mentioned SOMA script to create user and to find the status of users,

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
    <env:Body>


    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
                <dp:set-config>
                    <User name="UserName">
                        <Password>StartingPassword</Password>
                        <GroupName>NewGroupName</GroupName>   //we will provide group name if access level is group defined
                        <AccessLevel>group-defined | priviliged | user</AccessLevel>
                    </User>
                </dp:set-config>
    </dp:request>

    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
               <dp:get-status class="ActiveUsers"/>
    </dp:request>

     

    <!--You want to save the datapower objects as you are saving in webgui, so this can be done by the following script-->

    <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
    <dp:do-action>
    <SaveConfig/>
    </dp:do-action>
    </dp:request>


    </env:Body>
    </env:Envelope>

     

    David.

     

     

     

     

     

    Hi David /Swlinn

     

    Thanks for the replay i am trying with following script but it's throwing out me with malformed content could you please help on this ? and am looking for a script which gives all  users not Active users..do we have script for that? 

    {code}

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <dp:request domain="default" xmlns:dp="http://www.datapower.com/schemas/management" >
                <dp:set-config>
                    <User name="admin">
                        <Password>admin</Password>
                        <GroupName>Soma</GroupName>   
                        <AccessLevel>group-defined</AccessLevel>
                    </User>
                </dp:set-config>
    </dp:request>
    </env:Body>
    </env:Envelope>

    {code}

    Thanks

     

    Regards,

    Naren

     

     

     

  • David07
    David07
    73 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-16T06:26:36Z  

    Hi David /Swlinn

     

    Thanks for the replay i am trying with following script but it's throwing out me with malformed content could you please help on this ? and am looking for a script which gives all  users not Active users..do we have script for that? 

    {code}

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <dp:request domain="default" xmlns:dp="http://www.datapower.com/schemas/management" >
                <dp:set-config>
                    <User name="admin">
                        <Password>admin</Password>
                        <GroupName>Soma</GroupName>   
                        <AccessLevel>group-defined</AccessLevel>
                    </User>
                </dp:set-config>
    </dp:request>
    </env:Body>
    </env:Envelope>

    {code}

    Thanks

     

    Regards,

    Naren

     

     

     

    Hi,

    How you are communicating with the Datapower. Please provide  details like Url and the tool you are using . 

  • Datapower409
    Datapower409
    27 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-16T07:45:36Z  
    • David07
    • ‏2013-07-16T06:26:36Z

    Hi,

    How you are communicating with the Datapower. Please provide  details like Url and the tool you are using . 

    Hi David,

    I am using SOAPUI to test this and am also providing proper HTTP Authorization header but am not sure y it's failing and i am using URL as below

    https://IP:5550/service/mgmt/current

     

    Regards,

    Naren

  • David07
    David07
    73 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-16T09:05:14Z  

    Hi David,

    I am using SOAPUI to test this and am also providing proper HTTP Authorization header but am not sure y it's failing and i am using URL as below

    https://IP:5550/service/mgmt/current

     

    Regards,

    Naren

    HI,

    Your URL seems gud, but i think you are doing mistake while setting the Authorization header. In SOAPUI you want to pass authorization parameters in base64 encoded format.Otherwise try to use CURL editor, I think it ll help you.

    David 

  • HermannSW
    HermannSW
    4741 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-16T10:34:38Z  

    Hi David,

    I am using SOAPUI to test this and am also providing proper HTTP Authorization header but am not sure y it's failing and i am using URL as below

    https://IP:5550/service/mgmt/current

     

    Regards,

    Naren

    Hi Naren,

    I do use "doSoma" shell script (shown below) to not always having to remember the curl details.

    I only changed "admin" in your SOMA file to "admin3", as you can see the creation of user was successful:

    $ cat ~/bin/doSoma
    #!/bin/bash
    curl -k -u $1 --data-binary @$2 https://$3/service/mgmt/current $4
    $

    $ doSoma admin Naren.xml dp1-l3:5550 ; echo
    Enter host password for user 'admin':
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dp:response xmlns:dp="http://www.datapower.com/schemas/management"><dp:timestamp>2013-07-16T06:31:16-04:00</dp:timestamp><dp:result>OK</dp:result></dp:response></env:Body></env:Envelope>
    $
     

    Here are some postings on what you can do further with doSoma:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/tags/dosoma


    You might find this posting useful, which describes a simple method to get ALL sample SOMA requests:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/xml_management_sample_requests36


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • Datapower409
    Datapower409
    27 Posts

    Re: SOMA Script to Create a User??

    ‏2013-07-16T10:49:13Z  
    • HermannSW
    • ‏2013-07-16T10:34:38Z

    Hi Naren,

    I do use "doSoma" shell script (shown below) to not always having to remember the curl details.

    I only changed "admin" in your SOMA file to "admin3", as you can see the creation of user was successful:

    $ cat ~/bin/doSoma
    #!/bin/bash
    curl -k -u $1 --data-binary @$2 https://$3/service/mgmt/current $4
    $

    $ doSoma admin Naren.xml dp1-l3:5550 ; echo
    Enter host password for user 'admin':
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dp:response xmlns:dp="http://www.datapower.com/schemas/management"><dp:timestamp>2013-07-16T06:31:16-04:00</dp:timestamp><dp:result>OK</dp:result></dp:response></env:Body></env:Envelope>
    $
     

    Here are some postings on what you can do further with doSoma:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/tags/dosoma


    You might find this posting useful, which describes a simple method to get ALL sample SOMA requests:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/xml_management_sample_requests36


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Hi Herman,

    Thanks for replay, now am able to create user successfully could you please provide script for getting all users of the box,by using ActiveUsers class we only get active users details but i want entire box users.

    And also pls provide me script for deleting a user..tnx for your help

     

    Regards,

    Naren