I would like to feed data to a proxy which creates a soap XML request formatted as below:
<dat:MusicCollection>
           <!--Zero or more repetitions:-->
           <dat:Song>
              <dat:songUserkey>TakemeHome</dat:songUserkey>
           </dat:Song>
</dat:MusicCollection>
I have written the file to call the service and provide the details as below:
dim ucizi1 as SongRequest 'this is the request class in the proxy
dim Songs as Song = New Song
Songs.songUserKey = "TakeMeHome"
dim ucz
ucz = Songs.SongUserKey
ucizi1.SongCollection.Add(ucz)
The MusicCollection class is as follows:
<System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"),  _
 System.Runtime.Serialization.CollectionDataContractAttribute(Name:="ProductCollection", [Namespace]:="http://ucizi.Musicservice/DataContracts", ItemName:="Song")>  _
Public Class SongCollection
    Inherits System.Collections.Generic.List(Of ucizi.Music.DataContracts.Song)
End Class
The song class is as follows:
<System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"),  _
 System.Runtime.Serialization.DataContractAttribute(Name:="Product", [Namespace]:="http://Ucizi.Music/DataContracts")>  _
Partial Public Class Product
    Inherits Object
    Implements System.Runtime.Serialization.IExtensibleDataObject
    Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject
    Private SongUserkeyField As String
    Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData
        Get
            Return Me.extensionDataField
        End Get
        Set
            Me.extensionDataField = value
        End Set
    End Property
    <System.Runtime.Serialization.DataMemberAttribute(IsRequired:=true)>  _
    Public Property SongUserkey() As String
        Get
            Return Me.SongUserkeyField
        End Get
        Set
            Me.SongUserkeyField = value
        End Set
    End Property
End Class
However, when I run this code, I get an error: unable to cast object of type 'system.string' to type 'ucizi.music.DataContracts.Song'.
I cant see where this error is coming from, can some1 please help me and advise how I can correct this.
 
     
    