locked
How to calll webservice and send Paramater RRS feed

  • Question

  • User1449453972 posted

    how do send first parameter and second parameter to a webservice and Invoke it ?

    Tuesday, February 25, 2014 5:37 AM

Answers

  • User1449453972 posted

    I was able to redirect using below code

      Context.Response.Clear()

                Context.Response.Buffer = False

                Context.Response.Redirect("WS.asmx?op=ReturnResult")

    but now my question is how to rediterect with only one parameter name Username=Zuba

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 25, 2014 8:41 AM

All replies

  • User-760709272 posted

    http://forums.asp.net/t/1929936.aspx

    If you google "calling web service from asp.net" you'll find a lot of examples.

    Tuesday, February 25, 2014 6:18 AM
  • User1449453972 posted

    HI Aidy I was able to call webservice but I dont know how to send parameter while calling the webservice

    Tuesday, February 25, 2014 6:29 AM
  • User1449453972 posted

    How to call webservice and Pass Parameter Result without filling the textbox

    To test the operation using the HTTP POST protocol, click the 'Invoke' button.

    <form action="http://localhost:49759/TCL_DataSync_WS.asmx/ReturnResult" method="POST" target="_blank">
    Parameter Value
    Result: <input name="strResult" class="frmInput" size="50" type="text" />
    <input class="button" value="Invoke" type="submit" />
    </form>
    Tuesday, February 25, 2014 6:49 AM
  • User-1103138991 posted

    Hi zubayba,

    Yes you can do this using an AJAX call, and obtain the data using JSON.

    See the code example below: -

    $(document).ready(function() {
      $.ajax({
        type: "POST",
        url: "http://localhost:49759/TCL_DataSync_WS.asmx/ReturnResult",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
     
          // Insert the returned HTML into the <div>.
          $('#result').html(msg.d);
    alert(msg.d); } }); });

    Notice here, you pass the parameter inside the data parameter in AJAX. Based on the AJAX response, you can return the result object inside the variable msg, and place it inside a div tag called result. Or send an alert to the user.

    Make sure to allow the web service method to have the following tags to set the response format to JSON.        

            [WebMethod]
            [ScriptMethod(ResponseFormat = ResponseFormat.Json)]

    Tuesday, February 25, 2014 7:00 AM
  • User1449453972 posted

    I was able to redirect using below code

      Context.Response.Clear()

                Context.Response.Buffer = False

                Context.Response.Redirect("WS.asmx?op=ReturnResult")

    but now my question is how to rediterect with only one parameter name Username=Zuba

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 25, 2014 8:41 AM