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?

 

Thanks and Regards,

Anujit Karmakar


Thanks and Regards,
Anujit Karmakar
0
anujit
11/17/2008 1:57:11 PM
asp.net.web-forms 93655 articles. 4 followers. Follow

2 Replies
645 Views

Similar Articles

[PageSpeed] 51

The webservice don't recognize the WebAdd method that you want to use.

It's easier to add your webservice via "Add Web Reference" to your project, all proxy classes will be generated for you.



Please remember to click “Mark as Answer” so I know if my answer was good enough for you. Thanks.
0
Erwin21
11/17/2008 2:10:28 PM

Actually the following lines are not clear. What abt the parameter? If you kindly let me know. 

 

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");

 

Thanks and Regards,

Anujit Karmakar


Thanks and Regards,
Anujit Karmakar
0
anujit
11/18/2008 8:58:56 AM
Reply:

Similar Artilces:

Consuming Web service from .net 3.5 web application using ajax
Hi , Before in .net 2005 ,I use to consume the  web service from client side via Ajax and java script. that's just adding web service inside the script manger services.But  it was not possible with .net 2008 version WEB APPLICATION   , Even it works well with .net 2008 web sites. Please help me to solve the issue. I have no idea what you mean. Please post the code that "does not work". NC...   I have the same problem.  I have a .NET 3.5 Web Application not Web Site.  I fully qualify the web service with the namespace i,e,  &n...

new UsernameToken exception from web page that consumes web service using soap
I've the following problem, that is generating a UsernameToken in an asp.net page:1) a web service (.net 1.1, WSE 2.0 SP3) that requires soap authentication with myUsernameTokenManager implementation 2) a winForm client (.net 1.1, WSE 2.0 SP3) that consumes the web service passing a UsernameToken in the Soap messages. 3) a web client that does the same as the winForm client but with error when generating the UsernameToken to add to the SoapContext. Here is the piece of code: UsernameToken tok = new UsernameToken(CurrentUser.Instance.UserID, CurrentUser.Instance.Password, Passwor...

C#.NET WEB APPLICATION
hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

can someone one give me difference between web form and mobile web form and which or where or when i'm using the forms?
thanks Marc Hi Marc, Based on my understanding, you want to know the differences between the ASP.NET web application and ASP.NET mobile web application. If I have misunderstood you, please feel free to let me know. The ASP.NET forms are used to develop the ASP.NET pages for desktop browsers and The ASP.NET mobile forms are used to develop the ASP.NET pages for mobile device browsers. When we create the ASP.NET mobile web forms pages, we can use nearly all the features of ASP.NET. But there are a couple of compatibility issues: Error Handling and Reporting. Tracing. Using Redi...

Using a WebService from another web form
I am creating a web application which makes use of 3 diff web services. The application has 2 webforms: WebForm1.aspx & WebForm2.aspx. Somehow I am not able to access the WebServices from the WebForm2.aspx. How can I do this? The following article should help you;http://www.dotnetjohn.com/articles.aspx?articleid=9Regards, Narayana Rao Surapaneni Architect | Author | MCSD for .NET | MCSD | SCJP www.msdeveloper.info ...

How to consume a web service using SOAP
hello guys,    I have a webservice written in asp.net with vb.net as code behind.The return type of the web service is DataSet.I want  to access this web service using SOAP.Please send me the code as soon as possible.it's very urgent. Regards, Balaji.    Balaji,Chennai...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Need Windows Form to Retrieve Information From Web Form
I have a cash and carry web site that customers can order products, the next day come in to the company to pay and pickup. I would like to create a windows application for the company to do two things: 1. download all the orders from the day before 2. upload price changes, product changes, category changes I've search the internet and forums and the only thing I can find that I think would actually link these two together would be a web service. Can you please tell me if I am heading in the right direction or if there is another method to link the two applications, if there are any pitf...

Consuming Web Services using C#.NET
Hi, This is my first experience with SOAP webservices and I'm having problem in calling a function via SOAP web services. I have add the web services by following the steps provided in msdn: add web reference, put in the uri, press enter, etc... However, when I try to invoke the Login method. The return object is always null. Below is the extracted web services wsdl:- <wsdl:operation name="Login"> <soap:operation soapAction="" /> - <wsdl:input name="LogReq"> <soap:body use="literal" /> </wsdl:input> - &...

how to consume a .net webservice using java client ?
Hi experts, I really need your help. I have create one .net webservice , it is really simple , the code is shown below .   [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class Service1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { ...

Using excel/automation from a .net web form fails, why?
Hi all - From my codebehind I'm attempting to write the contents of a DataSet to Excel. However, it appears that I cannot start Excel from my codebehind to accomplish this. Doing so causes the following error: Cannot execute a program. The command being executed was "c:\winnt\microsoft.net\framework\v1.1.4322\csc.exe" /noconfig @"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\webservice_icspos_consumer\bd8c4cb9\af1c8054\s33rwgwf.cmdline". I've referenced Microsoft Excel 10.0 Object Library which also brings in - Microsoft Office 10.0 Obje...

Web Forms with no DLL using VS .NET IDE
Basically, I've been trying to make ASPX web pages with VS .NET and have learned a little of how to not use the DLL that gets created when the project is compiled and use the .VB source files themselves at run-time. I've been experimenting with changing the keyword CodeBehindFile to SRC; removing the project name from Inherits to look directly at the VB class (i.e. MyProject.MyClass to just MyClass.) I've been changing the private routines with in the class to be public. I have had sucess with getting the pages to work with code files. However, I've been having certain problems in .NET I...

using javascript to change .net web form properties
Hello everyone, I'm fairly new to ASP.NET and I'm trying to find the best solution to this problem I'm having.  I believe ultimately what I need to be able to do is change the ImageUrl value via javascript of an ImageButton.  A small example of what I'm working on can be found here in a javascript form:http://www.msu.edu/~sebenic3/This is a simple data input method for a survey. There are three distinct columns, when you select a number within a column it will change the .gif image to show it's selected and then populate the textbox with that value.  I...

Calling SOAP RPC webservice form .net 1.1.
Hi, I want call one webservice hosting in Java technology that use the SOAP RPC protocol from asp.net 1.1. The problem is, asp.net 1.1 not support SOAP RPC calls. I´m read about WSE2 but I don´t see information about this call type. In .net 2.0 exists this feature? Do you help me about it? Regards  Sergio SalanitriC# .Net Developer and Integrator.Buenos Aires, Argentina. WCF web service clients in .Net 3.0 and 3.5 support RPC. Thanks, but the infraestructure Technology of the company only have servers with .net 1.1 and 2.0. Do you know how I do call SOAP RPC with framewor...

Web resources about - Consume WebService Using SOAP - asp.net.web-forms

webservices Articles, Posts, Blogs, Videos - Technorati
— Authority: The job consist in a PHP program that read a file, compose a message (email or sms) and call an API of email provider (Amazon SES) ...

Section: software:webservices
Wired.com © 2012 Condé Nast. All rights reserved. Use of this Site constitutes acceptance of our User Agreement (effective 3/21/12) and Privacy ...

Products - CrunchBase
Product profiles

App Search on Flickr - Application Sharing!
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Wikipedia:Press coverage 2005 - Wikipedia, the free encyclopedia
If you add an article, please cite both the title and the source. Note that if you're listing an article from a traditional press wire service ...

Entity–relationship model - Wikipedia, the free encyclopedia
In software engineering , an entity-relationship model ( ER model for short) is an abstract and conceptual representation of data . Entity-relationship ...

Entity-relationship model - Wikipedia, the free encyclopedia
In software engineering , an entity-relationship model ( ER model for short) is an abstract and conceptual representation of data . Entity-relationship ...

IT and Telecommunications Jobs in Melbourne Metro - MyCareer
Find IT and Telecommunications Jobs in Melbourne Metro on MyCareer. Fresh IT and Telecommunications Jobs posted daily. Free email alerts and ...

AWS Elastic Beanstalk: A Quick and Simple Way into the Cloud
Flexibility is one of the key principles of Amazon WebServices - developers can select any programming language and software package,any operating ...

How To Use the Amazon SDK for Android to Upload Photos to Amazon S3
This article demonstrates how to use the AWS SDK for Android to upload an image to Amazon Simple Storage Service (S3) from your mobile device ...

Resources last updated: 1/14/2016 1:18:38 AM