.NET Soap request to Web service - Action not happening

I've searched and found lots on this topic, but I'm just not getting this to work. My request returns the HTML from asmx page that displays the web method (action), but does not perform the action, which basically returns a true/false.

I'm using the same SOAP 1.1 that my method provides. And, when I test the functionality by using the "Invoke" button provided it works just fine. But I really need to call this function behind-the-scenes so I can't use the HTTP Post like this button. Any ideas?

.cs code in App_Code directory of website:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Text;
using System.Web.Caching;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

[WebService(Namespace = "http://www.xxx.org/")]

public class VacationSickPayoutLogger : System.Web.Services.WebService

    public string RunVacationSickPayoutWS()
        return "True";

Code from asmx file:

<%@ WebService Language="C#" CodeBehind="~/App_Code/VacationSickPayoutLogger.cs" Class="VacationSickPayoutLogger" %>

Code to call web method:

protected void Page_Load(object sender, EventArgs e)
        string soap =
        @"<?xml version=""1.0"" encoding=""utf-8""?>
        <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
            <RunVacationSickPayoutWS xmlns=""http://www.xxx.org/"" />

        var _url = "http://localhost/HR/VacationSickPayoutLogger.asmx";
        var _action = "\"http://www.xxx.org/RunVacationSickPayoutWS\"";

        System.Xml.XmlDocument soapEnvelopeXml = CreateSoapEnvelope(soap);
        HttpWebRequest webRequest = CreateWebRequest(_url, _action);
        InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml, webRequest);

        // begin async call to web request.
        IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null);

        // suspend this thread until call is complete. You might want to
        // do something usefull here like update your UI.

        // get the response from the completed web request.
        string soapResult;
        using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult))
            using (StreamReader rd = new StreamReader(webResponse.GetResponseStream()))
                soapResult = rd.ReadToEnd();

    private static HttpWebRequest CreateWebRequest(string url, string action)
        HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
        webRequest.Headers.Add("SOAPAction", action);
        webRequest.ContentType = "text/xml;charset=\"utf-8\"";
        webRequest.Accept = "text/xml";
        webRequest.Method = "POST";
        return webRequest;

    private static System.Xml.XmlDocument CreateSoapEnvelope(string soap)
        System.Xml.XmlDocument soapEnvelop = new System.Xml.XmlDocument();
        return soapEnvelop;

    private static void InsertSoapEnvelopeIntoWebRequest(System.Xml.XmlDocument soapEnvelopeXml, HttpWebRequest webRequest)
        using (Stream stream = webRequest.GetRequestStream())


Need Your Help

how to display text in new line

iphone objective-c xcode

i wan to display the string line by line...what changes i shd make in the below code..

What is Interrupt Threading?

kernel freebsd interrupt

(NB: This is not about interrupting Java/.NET threads, this is about kernel-mode interrupts.)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.