views:

15

answers:

1

I have the following MessageContracts to use as a request:

<MessageContract(WrapperName:="get")> _
Public Class GetRequest
    Inherits BaseAuthenticatedRequest

    Protected _typeName As cEnum.eType
    Protected _id As Integer

    <MessageBodyMember()> _
    Public Property TypeName() As cEnum.eType
    ...

    <MessageBodyMember()> _
    Public Property Id() As Integer
    ...
End Class

<MessageContract(WrapperName:="getLimited")> _
Public Class GetLimitedRequest
    Inherits GetRequest

    Protected _propertyList As List(Of String)

    <MessageBodyMember(Namespace:=Api2Information.Namespace)> _
    Public Property PropertyList() As List(Of String)
    ...
End Class

But when testing in SoapUI, the getLimited request body is being created as:

  <v2:getLimited>
     <!--Optional:-->
     <v2:Id>?</v2:Id>
     <!--Optional:-->
     <v2:PropertyList>
        <!--Zero or more repetitions:-->
        <arr:string>?</arr:string>
     </v2:PropertyList>
     <!--Optional:-->
     <v2:TypeName>?</v2:TypeName>
  </v2:getLimited>

Where v2 = Api2Information.Namespace. What I really want is for the strings contained within PropertyList to be namespaced as v2, not arr. Is there anyway for me to achieve that? I'm converting an ASMX service to use WCF and we have a few applications where we cannot afford to have to recompile and redistribute.

Thanks for your helps!

A: 

I found what I was looking for. Using a custom collection type like:

<CollectionDataContract(Namespace:=Api2Information.Namespace)> _
Public Class PropertyList : Inherits List(Of String)

End Class

and replacing occurrences of it in my contracts like:

<MessageContract(WrapperName:="getLimited")> _
Public Class GetLimitedRequest
    Inherits GetRequest

    Protected _propertyList As PropertyList

    <MessageBodyMember(Namespace:=Api2Information.Namespace)> _
    Public Property PropertyList() As PropertyList
    ...
End Class

Produces the output:

  <v2:getLimited>
     <!--Optional:-->
     <v2:Id>?</v2:Id>
     <!--Optional:-->
     <v2:PropertyList>
        <!--Zero or more repetitions:-->
        <v2:string>?</v2:string>
     </v2:PropertyList>
     <!--Optional:-->
     <v2:TypeName>?</v2:TypeName>
  </v2:getLimited>
Wes P
Answer found here http://msdn.microsoft.com/en-us/library/aa347850(v=VS.90).aspx
Wes P