Same question with Raj Kumah. Let say I allow firstname parameter as optional parameter, while paramater1 and lastname are mandatory. How to get thing done?
Hi Kamal, If i need to pass only the second optional parameter , then how would my url look like ? does it look like this http://localhost:49785/Service.svc/parameter1?lastname=kamal?
Whereas TestMessage is my service name and p1 parameter is compulsory whereas firstname and lastname parameters are optional but u have to specify in the URI Template but keep one thing in mind while declaring the parameters as optional u have to first preceed them with ? and then parameter name and then use & to assign the second parameter as option as per your requirement. If u see in the function declaration also i have used the optional parameter feature of .Net 4.0
Step 2 - Function Definition
public string TestMessage(string message,string firstname="",string lastname="")
In the above output parameter1 is passed i.e firstname=kamal but you wont get lastname parameter, bcoz you didn't pass and its optional if u dont pass the parameter value and will take value as empty.
IndoCRM HRDPosted Jul 28, 2016, 12:06 AM
Same question with Raj Kumah. Let say I allow firstname parameter as optional parameter, while paramater1 and lastname are mandatory. How to get thing done?
Raj KumarPosted Jun 15, 2016, 11:46 AM
Hi Kamal, If i need to pass only the second optional parameter , then how would my url look like ? does it look like this http://localhost:49785/Service.svc/parameter1?lastname=kamal?