javascript - Web service 404 always due complex types -
i'm having problem passing complex data in call, 1 type html, 1 stringify json.
req_description = html req_services = json.stringify(somedata) here code
server interface [webget(uritemplate = "insertpedidos/{requestid}/{categorie}/{projecttype}/{sla}/{possibledate}/{desiredate}/" + "{desirejustification}/{services}/{description}/{workflowstate}/{tempid}", bodystyle = webmessagebodystyle.bare, responseformat = webmessageformat.json)] int insertpedidos(string requestid, string categorie, string projecttype, string sla, string possibledate, string desiredate, string desirejustification, string services, string description, string workflowstate, string tempid); implementation
public int insertpedidos(string pid, string requestid, string categorie, string projecttype, string sla, string possibledate, string desiredate, string desirejustification, string services, string description, string workflowstate, string tempid) { var data = new linqtorequestscontext(elevate.requestsurl); var ped = data.getlist<fdm_mainrequestsmainrequests>("fdm_mainrequests"); ped.scopetofolder(_folder, false); var insert = new fdm_mainrequestsmainrequests() { req_requestid = double.parse(requestid), req_categorie = double.parse(categorie), req_projecttype = double.parse(projecttype), req_slaondate = int.parse(sla), req_requestdate = datetime.now, req_possibledate = datetime.parse(possibledate), req_desiredate = datetime.parse(desiredate), req_desirejustification = desirejustification, req_services = services, req_description = description, req_worflow_state = int.parse(workflowstate), req_origin = 0, title = tempid, req_cru_datecreated = datetime.now, req_cru_usercreated = spcontext.current.web.currentuser.email }; ped.insertonsubmit(insert); data.submitchanges(); return 1; } client side
function insertorupdatepedido(id, how) { $("#img_progress").show(); var $treemain = $("#tt"); // source tree var data = $treemain.tree("getdata", $treemain.tree("getroot").target); var jdata = json.stringify(data); if (how > 0) { this.litem = list.getitembyid(how); } else { var formdata = { requestid: id, categorie: $("#sel_categories option:selected").val(), projecttype: $("#sel_projecttype option:selected").val(), sla: $("#tiposla").val(), possibledate: $("#dataprevista").val(), desiredate: $("#datadesejada").val(), desirejustification: $("#justificacaopedido").val(), services: jdata, description: $("#weditor").editor("gettext"), workflowstate: "1", tempid: tempid }; json.stringify(formdata); jquery.ajax({ cache: false, type: "get", url: "/_vti_bin/app/requests.svc/insertpedidos", datatype: "json", contenttype: "application/json; charset=utf-8", data: formdata, success: function(ret) { if (ret === 1) { messpopups("s", "pedido efetuado corretamente"); } } }); } } can give me clue? tried decodeuri() complex fields because passing "%2%2....", tried stingify data, no luck. there other way? think wrote code complex , not "kiss".
i´m stuck
thank joao
Comments
Post a Comment