javascript - How to call simple WCF service using jQuery or simple js -


I have a very simple Hello World WCF service, as shown below. When I call it through the ASP.NET project by adding web service reference it works perfectly well. But when I call it using jQuery or standard JS AJAX call (using XMLHttpRequest ), it calls back the success function but returns empty data.

When I tried to access it via the Firefox browser using this address: http: // localhost: 8282 / test / testservice.svc / helloword < / P>

This error returned an error with "a: ActionNotSupported" and error details

can not be processed on the message recipient with the

action, because a contract filter mismatch on Android Dispatch Due to this, it may be that the contract mismatch (between the sender and receiver) Mail verb) or a binding / secure match between the sender and the receiver. Check that the sender and the receiver have the same contract and one binding (security requirements, such as messages, transport, none).

If I wsHttpBinding then it does not return anything to Firefox

Here is the code:

The file "Test / iTest SYNCCCC":

  [service function (name space) = "http: // localhost: 8282 / ")] Public interface iTest service {{operationContract} string helloard (); }  

File "Test / TestSYRSCC":

  Public class test service: ITeS service {public string hello word ("return" is a resonance to server) Hello world "; }}  

The file "web.config"

& lt; System.serviceModel & gt; & Lt; Services & gt; & Lt; Service name = "radMLRPC.Test.TestService" behaviorConfiguration = "radMLRPC.Test.TestServiceBehavior" & lt; Endpoint address = "HelloWald" binding = "WebHTPBinding" contract = "radMLRPC.Test.itestService" & gt; & Lt; Identity & gt; & Lt; Dns value = "localhost" /> & Lt; / Identification & gt; & Lt; / Endpoint & gt; & Lt; Endpoint address = "Max" binding = "MaxHttpending" contract = "IMAXADEXXchange" /> & Lt; / Services & gt; & Lt; / Services & gt; & Lt; Behavior & gt; & Lt; ServiceBehaviors & gt; & Lt; Transaction name = "radMLRPC.Test.TestServiceBehavior" & gt; & Lt; ServiceMetadata httpGetEnabled = "true" /> & Lt; Service debug includes ExceptionDetailInFaults = "true" /> & Lt; / Behavior & gt; & Lt; / ServiceBehaviors & gt; & Lt; / Behavior & gt; & Lt; /system.serviceModel>

allows to allow soap requests with the above code so that our Receive the requests made by Modify the code below:

In the interface:

  [WebGet (UriTemplate = "helloworld")] [Operation Contract] string Helowwald ();  "WebHttpBinding" contract = "radMLRPC.Test.itestService" behaviorConfiguration = "webBehav" & gt;  
  • Then add the following tag in practice:

    & lt; EndpointBabers> & lt; Behavior name = "Webbahav"> & lt; WebHttp & lt; / Behavior> & lt; "Please remove extra space from above. It was not showing tags without additional locations"

  • P> Check some resources for:

    WCF http: //msdn.microsoft.com/en-us/magazine/dd315413.aspx

    Endpoint TV screencasts: < / P>

    • Construction of sluggish services with WCF (Part 1)
    • Build sluggish services with WCF (Part 2) http: //channel9.msdn.com/shows/ Endpoint / endpointtv-Screencast WCF-Part-2 /
    • Calling Wrecking Services at WCF - http: //channel9.msdn.com/shows/Endpoint/endpointtv-Scre Encast-Calling-RESTful-Services- Building-Restouach-Services -n-WCF /

    Usually Android There is really good coverage for TP WCF and WCF REST stuff. I Http: //channel9.msdn.com/shows/Endpoint/


    Comments