Consume webservice using SOAP

I have tried calling web service using SOAP. I tried the following code. But did not work. Its giving the error.
Code:
protected void btnTestSoap_Click(object sender, EventArgs e)
{
string strSoapEnvelope = "";
strSoapEnvelope =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>";strSoapEnvelope += "<soap:Envelope ";
strSoapEnvelope +=
"xmlns:xsi = \"http://www.w3.org/2001/XMLSchema-instance\" ";strSoapEnvelope += "xmlns:xsd= \"http://www.w3.org/2001/XMLSchema\" ";
strSoapEnvelope +=
"xmlns:soap= \"http://schemas.xmlsoap.org/soap/envelope/\">";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();objXMLHttp.open("POST", "http://localhost:1600/MyWebService/WebService.asmx",false,"","");
objXMLHttp.setRequestHeader(
"Content-Type", "text/xml; charset=utf-8");objXMLHttp.setRequestHeader("SOAPAction", "http://localhost:1600/MyWebService/WebService/WebAdd");
objXMLHttp.send(strSoapEnvelope.ToString());
objXMLHttp.waitForResponse(500);
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?
smaranika_sikdarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dirk HaestProject managerCommented:
Consume WebService Using SOAP
http://www.codeproject.com/KB/webservices/Consume_WebService.aspx


Create and Consume Web Services at Server and Client
http://www.asp101.com/articles/colin/webservices/default.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dirk HaestProject managerCommented:
The link has related information about the answer for this question.
I think that I should rewarded the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.