Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Getting Invalid Service call error when Web Service run from POSTMAN chrome extention

$
0
0

Hi,

I have created following Web Method:

[WebMethod]
    [ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
    public string PostData(Class1 param)
    {

        //Class1 param= new Class1();
        //param.FirstName = "Shashi";
        string Result = "";
        //  Result= JsonConvert.SerializeObject(param);
        Result = "success";
        return Result;
    }

Class:

[Serializable]
public class Class1
{

    private string name;

    public string FirstName
    {
        get
        {
            return name;
        }
        set
        {
            name = value;
        }
    }


}

Web.conf:

<?xml version="1.0"?><configuration><appSettings/><connectionStrings/><system.web><compilation debug="true" targetFramework="4.0"/><authentication mode="Windows"/><pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web></configuration>

Now When Invoked from POSTMAN getting Error:

  1. Selected Method as POST
  2. In URL in entered : http://localhost:31901/Service.asmx/PostData
  3. In Body Checked "raw" and Type JSON(application/json)
  4. Passed parameter as {"FirstName":"Shashikant"}

But getting Error:

{"Message": "Invalid web service call, missing value for parameter: 'param'.","StackTrace": "   at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)\r\n   at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n   at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType": "System.InvalidOperationException"
}

 

Please help!


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>