Click here to Skip to main content
15,886,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace WebApplication1
{
///
/// Summary description for WebService1
///

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{

[WebMethod]
public string HelloWorld(int rollno,params string[] fullname)
{
return rollno +"and"+fullname[0]+fullname[1]+fullname[2];
}
}
}


if i use int,string firstname,string middlename,string lastname, i am able to test in browser. but if i give like below

[WebMethod]
public string HelloWorld(int rollno,params string[] fullname)
{
return rollno +"and"+fullname[0]+fullname[1]+fullname[2];
}
}

when i click , helloworld, i am getting message like,
The test form is only available for methods with primitive types as parameters.

i could understood we can test with primitive type only such as int,string,bool.

is there any way to achieve my function to test in browser without consuming from another application?

so that i can debug and able to find any mistake inside the webserive method?
Posted
Comments
nika2008 27-Jun-14 8:29am    
you cant test Webservice Method who takes parameter array in browser only with code

u can do somethik like this in if u wanna just for test

calling the method fullname must looks like this
fullname = "name1$name2$name";

public string HelloWorld(int rollno,params string fullname)
{
string[] n = fullname.Split('$');
return rollno +"and"+n[0]+n[1]+n[2];
}
if u wanna just for test in brower

1 solution

Add this setting to web.config and visit asmx in browser again
C#
<configuration>
    <system.web>
    <webservices>
        <protocols>
            <add name="HttpGet" />
            <add name="HttpPost" />
        </protocols>
    </webservices>
    </system.web>
</configuration>

Look for same thread from microsoft site
http://support.microsoft.com/kb/819267
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900