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>
- <wsdl:output name="LogRes">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>

C# code:

SOAPServices proxy = new SOAPServices();
LogReq lReq = new LogReq();
LogRes lRes = new LogRes();

lReq.uname = txtUserName.Text.Trim();
lReq.pwd = txtPassword.Text.Trim();

lRes = proxy.Login(lReq); // The return object is always null

 

0
singleCoder
7/1/2008 8:55:33 AM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

2 Replies
728 Views

Similar Articles

[PageSpeed] 28

Hi there,

 Anyone can help me solve this problem?? Or is there anywhere I can have tutorial in consuming web services by using C#.NET 2.0?
Any help will be very much appreciated.

0
singleCoder
7/3/2008 6:33:58 AM

hi,

have u included a web service reference. if not then right click on your solution explorer and click "Add Web Reference" option and locate your web service. After that i your c# code, use the using directive as follows:

 using yourwebservicename;

then create its object and use it.
Hope this helps

Please dont forget to mark as answer if any post helps solve your problem.

Regards,

Faisal Shahzad

0
shahzadkhan34
7/3/2008 8:17:11 AM
Reply:

Similar Artilces:

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

Web service in .NET from Java Web Service
Hi there,I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.Here is the wsdl.<wsdl:definitions targetNamespace="http://www.dynix.com/schema/book">−<wsdl:types>−<schema targetNamespace="GetBookInfoByISBN">−<complexType name="BookInfoType">−<sequence><element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/><element maxOccurs=&quo...

Consuming a .NET web service in Delphi 2010 using a service reference
Hi, I've been asked to modify one of my existing applications (D2010 Win32) to interact with a web service written under VS2010/.Net 4. The information I have so far is :- "As communication is secured by .NET WsHttpBinding data encrypting, In order to consume it you have to add to your application a Service Reference (not a web reference) that joins the service available at the URL: http://ctm.mobilling.it/SmsComApi/Sms.svc . Assuming that the binding created in your app.confing is named "WSHttpBinding_ISms" you have to instantiate a client as shown below: {c...

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...

.NET web services Vs Java Web Services
Hello, does anyone know of a book or good source of information that compares .NET and Java Web Services? (I would like soemthing neutral if possible). I am thinking of approaching this subject for my dissertation? Many Thanks Rob Hi Rob, Last year I had to give a powepoint presentation on Web Services. I noticed some good books at barnes and noble that discussed the subject. These books were specific to Java and discussed Web Services in a very clear fashion. They gave some elementary examples that were easy to understand. I have not yet had the pleasure of creatin .NET Web Servi...

Converting windows application using web service from Visual C#.net 2003 to Visual Studio.net 2005
Hello, everyone! I have a solution which contains a windows project,a web service project and several other library projects. These projects were coded under visual c#.net 2003. Now I need to converted them to use Visual Studo.net 2005. Does any one know any article providing step-by-step guide  to converting WINDOWS APPLICATION with web service? I can find one under MSDN for converting web project.  But I guess I am a little confused if mine should follow this article since I am using web service in my windows application? Thanks a lot in advance.  ...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: http://msdn.microsoft.com/webservices http://www.microsoft.com/downloads/details.aspx?familyid=06255a94-2635-4d29-a90c-28b282993a41&displaylang=en https://www.sys-con.com/dotnet/article.cfm?id=458 Hope this helps....

What do non-.net users need to do to consume a .net web service?
Hello, I'm very new to web service world and haven't had much chance to do much reading on theory and architecture yet. So I'm asked to create one for someone external to my organization (still inside my company). I make one, test it, deploy it, consume it. Go me. It was very easy within my comfortable .net shop. However, the intended consumer is not a .Net shop (J2EE). I was under the impression that if I sent in a GET request to the asmx file, I would get XML back. This turned out to be not the case and I had to use the proxy file to prove that I could consume the service. S...

Consuming .net xml web service in PHP
I have developed .net xml web service. I want a develope php client to access this web service. I dont have much knowledge about PHP. The web service i wrote accepts two string parameters FirstName and LastName, and returns string like Welcome (FisrstName)__(LastName) to web service. The sample php client code i am trying is as below: <?php require_once('nusoap.php'); $parameters = array ("FirstName"=>"Russel", "LastName"=>"Arnold"); // Create a new Soap object $soapclient = new soapclient('http://testwebservice/Servi...

C#.NET Web services: Manipulating XML
Hi, I am developing a web service in C#.Net1.1 and a new bee to .NET. I have developed a web method to retrieve the data from database and I want to sent the response in the form of XML.I want to manipulate the dataset to get the desired XML.But I dont know how to do that? Can somebody help me in formatting the XML. Also, once I will format the XML, what return type I should use in web method to get XML file as output. Thanks in advance. First of all, I'm sure you already knnow that .NET 1.1 is rather old. At any rate, make sure you're using the latest service pack for .NET 1.1...

Best Practice for .Net Web Service access to a Web Service on a Test and Production Servers
Hello All, What is the best way to control a .Net web service to be able to access a remote server for testing and then point to another remote server to access the web service in production? Do I need to generate and maintain 2 different proxy objects? TIA, Bob Bob // first create the proxy if not isvalid( i_service) then i_service = create fundtraderproxy_TradeServicesClient_BasicHttpBinding_ITradeServices end if ///You'll see code something like this in the constructor of your proxy //dynamically set the endpoint url with the user supplied value - //r...

Re: Using XML Web Service in VS.NET
Dear all, I added a "test.asmx" file in my current project and I coded all Web Method in the test.asmx.cs in VS.NET. Now I want to ask how can I call the web methods in other C# Class? Suppose the class name of the asmx is "test". How can I instantiate the object of that class? Regards, Joe someone can correct me on this.... i hav done a walkthrough using XML webservice. I have created a windows application that can call methods from the webservice, with the use of a dataset in the webservice. after "adding a web reference" to my windows appli...

Changing URL in web.config for web service
I added a web reference to asmx file. In web.config - it adds - undefinedadd key="CoreService.CoreServices" value="http://test/CoreServices.asmx I then change it to <add key="CoreService.CoreServices" value="http://test2/CoreServices.asmx"/> But CoreService.CoreServices still looks for http://test/CoreServices.asmx.  What else do i have to change? I think CoreService.CoreServices are hard coded into the source code.  Girijeshhttp://www.girijesh.in/ I think CoreService.CoreServices are hard coded into the source code.  Girijeshhttp://www.girijesh.in/ So no ...

Web resources about - Consuming Web Services using C#.NET - asp.net.xml-web-services

Tumblr : How do teenagers waste hours upon hours consuming Tumblr?
Answer (1 of 6): I am a teenager and also have a fascination with Tumblr. I will try my best to explain this from our perspective as teens. This ...

Are You Consuming Your Coffee Correctly? - YouTube
Have you been doing it wrong? The Scientific Smell Challenge: https://youtu.be/bI5HEl3u848 SUBSCRIBE (it's free!): http://bit.ly/asapsci GET ...

Briton sentenced to four years for consuming hashish in Dubai
... to having 6.4 grams of the drug for his personal use and he will be deported after serving his sentence. DUBAI // A Briton charged with consuming ...

Eating meat is hurting the environment - stop consuming so much, top US nutritional panel says
The country's foremost nutrition advisory panel is taking a stand against meat: Americans should eat less of it, top experts say, in order to ...

Teen love shown to be most consuming
BACK in 1965, Cat Stevens wrote The First Cut is the Deepest. It turns out he was right. New research from a joint American and Australian study ...

Life-consuming quest
The news that Australian companies are to build open cut coalmines in the largest remaining tropical rainforest in Borneo fills me with despair. ...

The all-consuming market for markets
The all-consuming market for markets

Canadians consuming sky-high amounts of sodium, study finds
Canadians are consuming potentially dangerous amounts of sodium and Ottawa must take action to limit those levels, a leading expert on heart ...

13 Causes Of Insomnia, From Work Stress To What You're Consuming
After a long day, the only thing you want to do is crawl into bed for a good night's rest. Unfortunately, for 3.3 million Canadians, that isn't ...

Consuming Walker - AdPulp - AdPulp
It’s Sunday, which means it time to open The New York Times Magazine and read “Consumed,” the weekly column by Rob Walker. Today’s piece is about ...

Resources last updated: 12/21/2015 11:18:04 PM