powershellsoapwsdlnovellmicrofocus

Powershell Error creating entry through WSDL SOAP connection


So I am getting a conversion error when submitting something via WSDL SOAP in PowerShell. I am trying to create entries in a system called Kablink however although the entry has all the values etc. in the variable $soapData when I attempt the actual creation I get an error about being unable convert argument entry from one value to another even though both specified values are the same.

    Cannot convert argument "entry", with value: "folder_addEntry.FolderEntry", for "folder_addEntry" to type "folder_addEntry.FolderEntry": "Cannot convert the "folder_addEntry.FolderEntry" value of type
    "folder_addEntry.FolderEntry" to type "folder_addEntry.FolderEntry"."

Any ideas would be hugely appreciated as this is now driving me insane.

Below is the script I am using

    $kablinkSoapUrl  = "http://servername/ssr/secure/ws/TeamingServiceV1?wsdl"
    $kablinkConnector = New-WebServiceProxy -Uri $kablinkSoapUrl -Credential $Credential -namespace "folder_addEntry"
    #Set Binder ID to Shift Rota entries folder
    $binderID = 155
    #write-host $soapData


    #Import Objects and Populate Default Values
    $soapDescription = New-Object ("folder_addEntry.Description")
    $soapDescription.text = "Some Description"
    $soapDescription.format = 0
    $soapAttachment = New-Object("folder_addEntry.attachmentsField")
    $soapAttachment.name = ""
    $soapAttachment.type = ""
    $soapAttachment.attachments = @()
    $soapCreate = New-Object ("folder_addEntry.Timestamp")
    $soapCreate.date = get-date
    $soapCreate.principal = ""
    $soapCreate.principalId = 2
    $soapModify = New-Object ("folder_addEntry.Timestamp")
    $soapModify.date = get-date
    $soapModify.principal = ""
    $soapModify.principalId = 2
    $soapRating = New-Object ("folder_addEntry.AverageRating")
    $soapRating.averageRating = ""
    $soapRating.ratingCount = ""
    $soapCustBool = New-Object ("folder_addEntry.CustomBooleanField")
    $soapCustBool = @()
    $soapCustDate = New-Object ("folder_addEntry.CustomDateField")
    $soapCustDate = @()
    $soapCustEven = New-Object ("folder_addEntry.CustomEventField")
    $soapCustEven = @()
    $soapCustLong = New-Object ("folder_addEntry.CustomLongArrayField")
    $soapCustLong = @()
    $soapCustStriArr = New-Object ("folder_addEntry.CustomStringArrayField")
    $soapCustStriArr = @()
    $soapCustStr = New-Object ("folder_addEntry.CustomStringField")
    $soapCustStr = @()

    #Construct Entry

    $soapData = New-Object -TypeName folder_addEntry.FolderEntry
    $soapData.attachmentsField = $soapAttachment
    $soapData.averageRating = $soapRating
    $soapData.creation = $soapCreate
    $soapData.customBooleanFields = $soapCustBool
    $soapData.customDateFields = $soapCustDate
    $soapData.customEventFields = $soapCustEven
    $soapData.customLongArrayFields = $soapCustLong
    $soapData.customStringArrayFields = $soapCustStriArr
    $soapData.customStringFields = $soapCustStr
    $soapData.definitionId = "8a8ab38c62d40d5c0162fc8330eb01ad"
    $soapData.description = $soapDescription
    $soapData.entityType = "fileEntry"
    $soapData.eventAsIcalString = 0
    $soapData.family = "file"
    $soapData.id = ""
    $soapData.modification = $soapModify
    $soapData.parentBinderId = 155
    $soapData.permaLink = ""
    $soapData.title = "PowerShell Entry"
    $soapData.docLevel = 1
    $soapData.docNumber = ""
    $soapData.href = ""
    $soapData.preDeleted = 0
    $soapData.preDeletedBy = ""
    $soapData.preDeletedWhen = ""
    $soapData.reservedBy = ""
    $soapData.workflows = @()

    # Print Soap Data
    $soapData
    # Submit Entry
    $kablinkConnector.folder_addEntry("",$soapData,"")

Thanks in advance.


Solution

  • Added -class "folder_getEntry" when creating the $kablinkConnector variable making the line

        $kablinkConnector = New-WebServiceProxy -Uri $kablinkSoapUrl -Credential $Credential -namespace "folder_addEntry" -class "folder_getEntry"
    

    And now it works