Consume webservice using SOAP

Posted on 2008-11-18
Last Modified: 2013-11-18
I have tried calling web service using SOAP. I tried the following code. But did not work. Its giving the error.
protected void btnTestSoap_Click(object sender, EventArgs e)
string strSoapEnvelope = "";
strSoapEnvelope =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>";strSoapEnvelope += "<soap:Envelope ";
strSoapEnvelope +=
"xmlns:xsi = \"\" ";strSoapEnvelope += "xmlns:xsd= \"\" ";
strSoapEnvelope +=
"xmlns:soap= \"\">";strSoapEnvelope += "<soap:Body>";
strSoapEnvelope +=
"<AddTwoNumbers xmlns=\"http://localhost/wwwroot/addnumbers/Service1\">";strSoapEnvelope += "<a>10</a>";
strSoapEnvelope +=
"<b>12</b>";strSoapEnvelope += "</AddTwoNumbers >";
strSoapEnvelope +=
"</soap:Body>";strSoapEnvelope += "</soap:Envelope>";
objXMLHttp =
new MSXML2.ServerXMLHTTP40();"POST", "http://localhost:1600/MyWebService/WebService.asmx",false,"","");
"Content-Type", "text/xml; charset=utf-8");objXMLHttp.setRequestHeader("SOAPAction", "http://localhost:1600/MyWebService/WebService/WebAdd");
string outXML = objXMLHttp.responseText.ToString();
Label1.Text = outXML.ToString();
 Error :
soap:ClientSystem.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://localhost:1600/MyWebService/WebService/WebAdd. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response) at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
 Is there any solution to get rid of?
Question by:smaranika_sikdar
    LVL 53

    Accepted Solution

    Consume WebService Using SOAP

    Create and Consume Web Services at Server and Client
    LVL 53

    Expert Comment

    The link has related information about the answer for this question.
    I think that I should rewarded the points.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now