I am trying to submit an array in MonoTouch to a vb.net web service. Here is the web service:
Public Function Add_Array(ByVal arr()() As String, ByRef sMessage As String) As Boolean
Dim a, b, c As String a = arr(1)(0) b = arr(1)(1) c = arr(1)(2) sMessage = a + ", " + b + ", " + c + ". Submittion was recieved, and Second items are showen."
Return True
End Function
I added the web service by going to Add Web Reference, adding in the Web Service URL, and selecting .NET 2.0 Web Services as the Framework and then wsFish as the reference.
Here is my MonoTouch code:
wsFISH.Service1 wsArray;
string[][] abc = new string[6][];
string[] xyz = new string[3];
string t="";
xyz[0] = “a”;
xyz[1] = “b”;
xyz[2] = “c”;
abc[0] = xyz; ...
wsArray.Add_Array(abc, ref t);
This is the error I am getting: “The best overloaded method match for ‘Add_Array(string, ref string)’ has some invalid arguments Argument ‘#1’ cannot convert ‘string[][]’ expression to type ‘string’”
I have written C# code outside of monotouch that will access the web service using the exact code I have in monotouch. Any ideas?
Here is the answer I found. There are two parts to it.
First, I needed to add the correct references:
Second, I was using a Jagged array which did add some issues. Doing what @DaveFerguson suggested (changing the generated code) was the solution to this.