Mayur  Gujrathi

Mayur Gujrathi

  • 514
  • 4.1k
  • 891.1k

how to invoke wcf service having list parameter

Jul 22 2013 4:36 AM
I have a webservice as below
 
<OperationContract()> <Web.WebGet(UriTemplate:="/GetData?strErrMsg={strErrMsg}&chrErrFlg={chrErrFlg}", ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Wrapped)> _
Function GetData(ByRef strErrMsg As System.Collections.Generic.List(Of String), ByRef chrErrFlg As String) As String
 
And I am trying to fetch it as
 
http:localhost//BedTypeMasterService.svc/GetData?strErrMsg="ff"&chrErrFlg="dd"
 
But it is giving following error
 
Operation 'GetData' in contract 'iBedTypeMaster' has a query variable named 'strErrMsg' of type 'System.Collections.Generic.List1[System.String]', but type 'System.Collections.Generic.List1[System.String]' is not convertible by 'QueryStringConverter'. Variables for UriTemplate query values must have types that can be converted by 'QueryStringConverter'.
 
Please help me out to solve this

Answers (2)