c# - WCF Service - Return Class Object With Class Name -
i creating wcf web service
below interface
[operationcontract] [webinvoke(method = "post", uritemplate = "documentdispatchpolicyno", responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.wrappedrequest)] list<dispatchdocument> documentdispatchpolicynopost(string correlationid, string policynumber);
my function in svc file is
public list<dispatchdocument> documentdispatchpolicynopost(string correlationid, string policynumber) { list<dispatchdocument> rinfo = new list<dispatchdocument>(); ..... return rinfo; }
my output is
{ "add": "ashirwad-59 4th floor, flat 4-b tc road, new ali pur kolkata 700053 pin-west benga", "chequeamount": "0.00", "chequedate": "", "chequenumber": "", "dept": "pos", "dispatchdate": "27-oct-2016", "dispatchid": "2_118629", "dispatchmode": "i-post", "dispatchstatus": "sent", "dispatchtype": "direct customer", "message": "", "podnumber": "", "receiveddate": "", "status": "success", "ticketnumber": "" }
but want output as
{ documentdispatch: [ { 'add': 'ashirwad-59 4th floor, flat 4-b tc road, new ali pur kolkata 700053 pin-west benga', 'chequeamount': '0.00', 'chequedate': '', 'chequenumber': '', 'dept': 'pos', 'dispatchdate': '27-oct-2016', 'dispatchid': '2_118629', 'dispatchmode': 'i-post', 'dispatchstatus': 'sent', 'dispatchtype': 'direct customer', 'message': '', 'podnumber': '', 'receiveddate': '', 'status': 'success', 'ticketnumber': '' }] }
create following class
public class documentdispatchobject { public list<dispatchdocument> documentdispatch }
use above class
public documentdispatchobject documentdispatchpolicynopost(string correlationid, string policynumber) { documentdispatchobject rinfo = new documentdispatchobject(); ..... return rinfo; }
Comments
Post a Comment