Jump to content
Søren Huus

createChangeOrder - Powershell with WebProxy

Recommended Posts

I am in the early process of writing a powershell module with cmdlets for CA Service Desk Manager.

How do I get a list of available change categories? That is what I am doing wrong, yes?

$Username = "myuser"

$Password = "xxxxxxx"

$url = "http://xxxxxxxxx:8080/axis/services/USD_R11_WebService?wsdl"

$webservicex = New-WebServiceProxy -Uri $url -namespace WebServiceProxy -Class USD_WebServiceSoap

$SID = $webservicex.login($Username, $Password)

$attrVals = "summary", "A new change order", "description", "new change order","catagory", "chgcat:400001"

[string]$x = ""

[string]$y = ""

# createChangeOrder( int sid, String creatorHandle, ArrayOfString attrVals, ArrayOfString propertyValues, String template, ArrayOfString attributes, StringHolder newChangeHandle, StringHolder newChangeNumber)

$webservicex.createChangeOrder($SID, $($webservicex.getHandleForUserid($SID,"myuser")), $attrVals, "", "", "", [ref]$x, [ref]$y)

Exception calling "createChangeOrder" with "8" argument(s): "Error setting attr 'catagory' on object 'chg:408430' to value 'chgcat:400001' AHD03066:Unknown name catagory"

At line:15 char:43

+ ... der($SID, $($webservicex.getHandleForUserid($SID,"muser")), $attr ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException

+ FullyQualifiedErrorId : SoapException

 

Share this post


Link to post
Share on other sites

Ahh, misspell, category.

Exception calling "createChangeOrder" with "8" argument(s): "INVALID AHD03075:Required attribute requestor is missing from object Change Order AHD03075:Required attribute requestor is missing from object Change Order

 

Seems I am missing some attributes in my array...

Share this post


Link to post
Share on other sites

Fixed: 

$password = "xxxx"
$username = "myusers"

# Set webservice URL
$url = "http://xxxxxxxxx:8080/axis/services/USD_R11_WebService?wsdl"

$webservicex = New-WebServiceProxy -Uri $url -namespace WebServiceProxy -Class USD_WebServiceSoap

$SID = $webservicex.login($Username, $Password)

$attrVals = "summary", "A new change order", "description", "new change order","category", "6102", "active", 1, "affected_contact", "C829C2FCE01BDA48BDCACE4A04798DBC", "requestor", "C829C2FCE01BDA48BDCACE4A04798DBC"

[string]$x = ""
[string]$y = ""

$webservicex.createChangeOrder($SID,    $($webservicex.getHandleForUserid($SID,"sorras")), $attrVals,                     "",                             "",              "persistent_id",                       [ref]$x, [ref]$y)

Share this post


Link to post
Share on other sites

Hello ,

I am trying to Run the script which you have mentioned. I am struggling to execute it. Can you please let me know what are these guids you are referring to .

$attrVals = "summary", "A new change order", "description", "new change order","category", "6102", "active", 1, "affected_contact", "C829C2FCE01BDA48BDCACE4A04798DBC", "requestor", "C829C2FCE01BDA48BDCACE4A04798DBC"
 

Regards.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Announcements

    • Gregg

      Looking for the wiki content?

      12/20/2015

      Until I can transfer the wiki content over to the new Articles, you can find the old content here: http://www.greggsmith.net/wiki.
    • Gregg

      New site logo

      01/06/2016

      A special thanks to brianshs for creating a new site logo!
×