.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Asad Ali
Fauzul Azmi
Post New Web Links

Consume a .NET webservice

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :.NET Framework
Hi, I am new to web services and I have done a little homework in web services. I was able to consume the web service and I am able to see all the web methods. My question is that according to my assumption web method takes in XML data which I am not sure of how to send the data in XML form. I will explain with a sample example. Here is a web method "UpdateContact"  and the input parameters are ClientName, PassKey, ContactID, AttributesXML. What is the AttributesXML as the input parameter. According to my understanding, all the values in the form are to be converted to the XML form and send it to the web method using the AttributesXML parameter. I wanted to know is my understanding right or wrong. If it is right please guide me in sending the data to the web method in the XML form. If I am wrong please give me a clear understanding. Thanks in advance  

View Complete Post

More Related Resource Links

Can't consume a WebService in C#

Greetings all, i have a problem with a webservice i need to call. I'm working with vs2010, C# and .Net 4.   Whenever i try to call the service i get the following ProtocolException: The content type "multipart/related; type="application/xop+xml"; boundary="----=_Part_0_159582014.1283501395804"; start=""; start-info="application/soap+xml"" of the response does not match the binding (application/soap+xml; charset=utf-8) Does anyone have an idea what goes wrong there? I dont have access to the Webservice as its provided from a thrid party.

How to consume webservice to populate textbox


Regarding an InfoPath template:

I've got a webservice with one parameter/argument - callID

There are two textboxes that are related to this - - I have one textbox in which the user enters the callID - then a button that, when pressed, I need to populate the second textbox with the output of the webservice, but I'm totally confused and haven't found how to use a Rule to do this kind of thing.

Can someone help, please?

How to consume api webservice of another site and publish content on my own page?



I would really appriciate if someone could show me example of how to use api webservice of another site and retreive content (or whatever data is returned) and publish that content localy on omy own site. Api webservice I´m planning to use has support for HTTP GET & POST and SOAP 1.1 and 1.2.

I created my site with webmatrix and razor.I tryed searching on the net but I'm having hard time finding relevant content. Perhaps you can advise me what words to search for?

I hope you can help me.

Many thanks!







Unable to consume a Java webservice from .Net client ( 2005 )



Am trying to consume a Java webservice deployed in Weblogic using Apache axis plugin. I am unable to add the Web reference from .Net client Below find the error thrown by .Net client

AXIS error

Sorry, something seems to have gone wrong... here are the details:

Fault - makeTypeElement() was told to create a type "{http://discovery.co.za/PolicyDetails/}>>>PolicyDetailsReply>PolicyResultsList>PolicyResults", with no containing element
AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException faultSubcode: faultString: makeTypeElement() was told to create a type "{http://discovery.co.za/PolicyDetails/}>>>PolicyDetailsReply>PolicyResultsList>PolicyResults", with no containing element faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}hostname:dhpxenvdi8
Error message from the Apache server :
2011/05/11 10:38:46 AM> <Error> <HTTP> <BEA-101362> <[weblogic.servlet.internal.WebAppServletContext@1404d1 - appName: 'PolicyDetailsWSServiceEAR', name: 'PolicyDetailsWSService', context-path: '/PolicyDetailsWSService', spec-version: '2.5'] could not deserialize the servlet-context scoped attribute with name: "AxisEngine"
java.io.NotSerializableException: org.apache.axis.configura

saving XML output from webservice


 I created a webservice that takes casenum as input and gives results as a dataset in an XML.

I could make a web client to display the resulting dataset in a grid view. Pls see my code copied below.

Now I want to create a console client that takes the casenum as input, to call the webservice and saves the resulting xml for further processing, but can't figure out how to just capture the xml to save. Here's the code for my web client. I would appreciate if you could help modify this tocapture the resulting xml to save file locally.

Thank You.

namespace ResultsWebServicesClient
    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

        private void BindDataToGrid(string CaseNum)
            FG_Results results = new FG_Results();
            DataSet ds1 = new DataSet();
            ds1 = results.Get_FG_Results(CaseNum);
            GridView1.AutoGenerateColumns = true;
            GridView1.DataSource = ds1.Tables[0];

        protected void GetResults(object sender, EventArgs e)


HTTP Post and WebService


I am working on a application which will accept the data in the post request. My application also wants to expose a web service and want to call another web service. Considering all these 3 action that I want to do, can I create a single application which will have a web form which will accept the POST request and expose a web service at the same time.

Although it may be possible to achieve this, Is this a correct way of doing it?

Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

C# / Java webservice


I am writting a client applicatin that acesses a webservice written by another company.  I need to test against this webservice but since it is live I need another place to test with.  I don't have access to the code from the webservice but have added a reference to my project.  I would like to create a test platform using C# which will run on IIS and not Java.

I have created a basic webserive using both the NetBeans platform and the VS/C# platform.  The problem I am having is if I dynamically change the web address from one to the other my client application complains that the webservice is invalid.  I have verified all the calls are the same.

Are there any setting with VS/C# that allow me to configure it to behave more like the Java webservice?  I don't have the server support to host the Java application for full testing along with other problems using the Java version.

I have run both services in the "WCF Test Client" and can see where the WCF service uses the varibles for request and the Java uses body/request but can't get the WCF to follow that format.  I read somewhere about changing the OperationContract with SoapRpcMethod but then the mentod is not longer exposed. I also tried a Web Service in .NET 3.5 instead of a WCF server but that seems to be more trouble and does not

Printing crystal report from webservice



I am trying to print crystal repot directly from a C# application, which is calling webservice. I am able to display report in crystalreportviewer by passing the webservice call to datasource. However, is there anyway, I can print directly without showing the report?

Alternatively, I was trying return ReportDocument object from webservice, which would solve my problem, but I was unable to return the ReportDocument because of serialization issue. Is it even possible? Thank you


Data 2.0: Expose And Consume Data in A Web Services World


The goal of the ADO.NET Data Services Framework is to create a simple REST-based framework for exposing and consuming data-centric services easily.

Elisa Flasko and Mike Flasko

MSDN Magazine August 2008

Smart Clients: Build A Windows Forms Control To Consume And Render WSRP Portlets


Smart client apps use local resources, provide a rich client experience, and support intelligent install mechanisms. Web services offer powerful interoperability and integration features. Find out how to combine them to develop integrated apps that incorporate data from disconnected sources.

Carl Nolan

MSDN Magazine February 2006

Writing Data to database with jQuery Forms, ASMX Webservice, & JSON - help!



Can someone point me in the right direction on how to submit data from a jQuery form to a ASMX webservice? I have gotten everything on the form ready to be submitted to the database and now I am stuck on how to send it over using $.ajax(). Everything I have read tells me how to get data from a webservice and display it with jQuery, but not the other direction nor how to access the json data within the within the webservice service(similar to a Request.Form approach with ASP.NET forms).

In other words: 

1. What do I need to do to my webservice to make sure it can receive data from the jQuery form. 

2. What do I need to do in jQuery to receive an acknowledgement the save on the server side was successful. 

I can explain more if need be, but if there is a comprehensive tutorial on not only reading, but also WRITING data with jQuery, JSON, etc. I would love to get pointed in that direction. 

Webservice using socket layer programming



   I want to access a webservice in asp.net programming. This webservice was done using socket layer programming and also i am having the ipaddress and port address. Did any one know about how to access webservice using socket layer and if know let me know how to access the webservice. Thank you

problem with webservice



I wrote a program that connects to a webservice (with client side script such as jquery) and fetches data from  the webservice.

Now the program is working properly in local system, but when I upload it to host, the script cannot connect to the webservice.

What is the problem?

[newbie] How to return a data record from a webservice (wsdl)?



vs2010, .NET 4.0

I have a webmethod which I want to return a data record (for example: name, surename, address, age, zip etc)

I wonder how to accomplish this. I think the solution is about creating an object which contains all the records serialized. And then the webmethod returns this serialized object. I'm not 100% sure how to accomplish this, if some of you good provide me with some tips, tutorial or link to an article explaining it, that would be great

UpdateListItems Webservice is not working on Photo directory in blogsite



   I have created a site using the standard blogsite template. By default it contains a picture library named "Photos". I want to create a new folder in this library using the UpdateListItems Webservice. But I am getting an exception saying "The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file." But there is not file/folder with the name I am specifying. I am using the following query to create the folder



  <Batch PreCalc="TRUE" OnError="Continue" RootFolder="/forexp/Photos">

  <Method ID="1" Cmd="New">

  <Field Name="ID">New</Field> 

  <Field Name="FSObjType">1</Field> 

  <Field Name="FileRef">/blogsite/Photos/TestFolder</Field> 




Please note that I can create the folder using the web interface. I also created a new picture library in the same site and used the same above query to create the folder and I am able to create the folder.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend