U M A M A H E S H
U M A M A H E S H

Reputation: 75

WcfRestfulServices passing parameters apart from body not QueryString in Postman

When i passing parameters through querystring in Postman for hitting my Wcfrestfulservices it's working fine. Client POSTMAN ::

http://localhost:12345/InvestUtiServices.svc/GetFoliosbyPAN?ApplicationID=jdhd@dkj&Password=ddjkk3ODkk-JhifhR7t4/k=&AppVersion=5.0&DeviceDetails=10.134.4.44&Source=website&PAN=BDXFD2F

in Service ::

public Stream GetFoliosbyPAN(string ApplicationID, string Password, string AppVersion, string DeviceDetails, string Source, string PAN)

But based on client requirement we shouldnot passing parameters through querystring only from body. Like in Postman body:

http://localhost:51462/InvestUtiServices.svc/GetFoliosbyPAN
{
"ApplicationID" : "dfdfd",
"Password" : "sddf",
"AppVersion" : "5.0",
"DeviceDetails" : "10.333.3.33",
"Source" : "website",
"PAN" : "dfdddf"
}

But values are not passing, we get null values when hitting the service.

How can i pass values from body in POSTMAN?

Thanks in advance.Parameters apart from body

Upvotes: 1

Views: 1171

Answers (1)

Mukesh Modhvadiya
Mukesh Modhvadiya

Reputation: 2178

First of all your method must be a POST method, then only it will accept post parameters.

Second, you are passing parameters as a JSON object

{
"ApplicationID" : "dfdfd",
"Password" : "sddf",
"AppVersion" : "5.0",
"DeviceDetails" : "10.333.3.33",
"Source" : "website",
"PAN" : "dfdddf"
}

So you need to change your method declaration that uses complex object containing all the parameters as properties

From

public Stream GetFoliosbyPAN(string ApplicationID, string Password, string AppVersion, string DeviceDetails, string Source, string PAN)

To

public Stream GetFoliosbyPAN(UserInfo info)

where UserInfo will be a class with your parameters as properties.

Upvotes: 1

Related Questions