Reputation: 37
I want to write a web method having its one argument as an Array/List. The code builds successfully but on browser to test it shows following message. The test form is only available for methods with primitive types as parameters.
[WebMethod]
public string Concat(params string[] arr,int a,int b)
{
string result = "";
for (int i = 0; i < arr.Length; i++)
{
result += arr[i];
}
int c=a+b;
return result+'_'+c.Tostring();
}
Upvotes: 0
Views: 237
Reputation: 2174
string[] it's not a primitive type, as String, o a Integer are.
Maybe you can try SoapUI (http://www.soapui.org).
Or you can place it into a test ASPx page, as a static method, and try it so, vía JS:
function test() {
PageMethods.Concat(array_values,integer1,integer2);
}
function test_callback(result){
alert(result);
}
Upvotes: 1