c# - WCF AJAX Cannot infer schema. The Request/Response body is wrapped -


i'm working on connecting web form ssis through wcf web service. issue started out issue cross-referencing service, , has become issue service giving error in title.

here code:

//service [servicecontract] public interface iextractionservice {     [operationcontract]     [webinvoke(method = "post",         requestformat = webmessageformat.json,         responseformat = webmessageformat.json,         bodystyle = webmessagebodystyle.wrapped,         uritemplate = "/submitextraction")]     string runextraction(string start, string end, string packagename); }   public string runextraction(string start, string end, string packagename)     {         //code run ssis package     }  //javascript $("#btnsubmit").click(function () {     var startdatetime = ($("#from").data + " 00:00:00");     var enddatetime = ($("#to").data + " 23:59:59");     var extractiondata = {         "start": startdatetime,         "end": enddatetime,         "packagename": $("#packagename").data     };     $.ajax({         type: "post",         url: "extractionservice.svc/runextraction",         data: json.stringify(extractiondata),         contenttype: "application/json; charset=utf-8",         datatype: "json",         processdata: true,         success: function (data, status) {             alert("success..." + data);         },         error: function () {             alert("failed");         }     }) })  //global.asax.cs protected void application_beginrequest(object sender, eventargs e) {     httpcontext.current.response.addheader("access-control-allow-origin", "*");     if(httpcontext.current.request.httpmethod == "options")     {         httpcontext.current.response.addheader("access-control-allow-methods", "get, post");         httpcontext.current.response.addheader("access-control-allow-headers", "content-type, accept");         httpcontext.current.response.addheader("access-control-max-age", "1728000" );         httpcontext.current.response.end();     } }  //web.config <system.servicemodel>   <bindings>     <basichttpbinding>       <binding name="basichttpbinding_iextractionservice" />     </basichttpbinding>   </bindings>   <standardendpoints>     <webhttpendpoint>       <standardendpoint name="" helpenabled="true" automaticformatselectionenabled="true"></standardendpoint>     </webhttpendpoint>   </standardendpoints>   <client>     <endpoint address="http://localhost:49313/extractionservice.svc"     binding="basichttpbinding" bindingconfiguration="basichttpbinding_iextractionservice"     contract="extractionservices.iextractionservice"        name="basichttpbinding_iextractionservice" />   </client>   <behaviors>     <servicebehaviors>       <behavior name="">         <servicemetadata httpgetenabled="true" httpsgetenabled="true" />         <servicedebug includeexceptiondetailinfaults="false" />       </behavior>     </servicebehaviors>   </behaviors>   <servicehostingenvironment aspnetcompatibilityenabled="true"     multiplesitebindingsenabled="true" /> </system.servicemodel> 

this should need. if there else, can put up. feel small. have been putting of bit bit , know can choppy, feel majority of in working order. appreciated.

in ajax call, accessed url, put in method name follows:

$.ajax({     type: "post",     url: "extractionservice.svc/runextraction",     data: json.stringify(extractiondata),     contenttype: "application/json; charset=utf-8",     datatype: "json", 

the service had uri specified did not click in head until after second glance, when changed url match uri instead of method name follows:

$.ajax({     type: "post",     url: "extractionservice.svc/submitextraction",     data: json.stringify(extractiondata),     contenttype: "application/json; charset=utf-8",     datatype: "json", 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -