Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Restfull WS post method and HTML form
    primarykey
    data
    text
    <p>I have simple .net restful web service published on IIS:</p> <pre><code> [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "formTestGET?firstInput={firstInput}&amp;socondInput={socondInput}")] string formTestGET(string firstInput, string socondInput); [OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, UriTemplate = "formTestPOST")] string formTestPOST(string testInput); </code></pre> <p>Implementation of methods:</p> <pre><code> public string formTestGET(string firstInput, string socondInput) { try { return "First Input value: " + firstInput + " Second Input value: " + socondInput; } catch (Exception e) { return e.Message; } } public string formTestPOST(string testInput) { try { return "Post paramether value: " + testInput; } catch (Exception e) { return e.Message; } } </code></pre> <p>My html form:</p> <pre><code> &lt;form method="post" action="http://localhost/HTML5RestfulService/Service1.svc/formTestPOST"&gt; &lt;fieldset&gt; &lt;legend&gt;Form Post Request&lt;/legend&gt; &lt;input name="testInput"/&gt; &lt;button&gt;Make Post Request&lt;/button&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>I just want to consume this service by the html form. I have problem with my POST method. It works fine when I call it with the Ajax (from java script), but through the form I can not get response. I am getting "400 Bad Request" as a error.</p> <p>Should I configure my WS differently when I want to call it through the FORM?</p> <p>Any advice, please.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload