0

My web service takes string [][] as a parameter, but when I call webservice method it gives error:

cannot convert from 'string[][]' to 'ServiceReference1.ArrayOfString[]

//strItems1 is the array
string [][] strItems1 = new string[m_Inputs][];
for (int i =0; i < m_Inputs; i++)
    strItems1[i] = new string[2];

for (int i =0; i < m_Inputs; i++)
{
    strItems1[i][0] = "test";
    strItems1[i][1] = "test 1";
}
oS.CostFromStringArray(strItems1, oDB.EscapeString(STZ.Text), Total); //web service method on which i am getting error

It's just a string table that is always going to be string[n][2], i also tried using multi-dimensional arrays but wsdl gave error that use jagged arrays instead.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
PUG
  • 4,301
  • 13
  • 73
  • 115

1 Answers1

0

Web Service type was of data type array, used a list<> and before passing it in to web service method do a list<>.ToArray() for soap to be able to serialize it. You can also change the web service data type. Right Click on service refrence > Configure Service > Data Type Fields

PUG
  • 4,301
  • 13
  • 73
  • 115