|
|
|
|
|
|
|
Page Views :
|
4847
|
|
Downloads :
|
0
|
|
Rating :
|
Rate it
|
|
Level :
|
Intermediate
|
|
Summary
In this Article I am going to show you how to consume Microsoft knowledge base web service from our client application, this service provided by www.santra.com. This web service exposes three web methods to access over the web. They are KBFullList, KBTitle, KBSearch I got this functions details when I am going through the WSDL files.http://rob.santra.com/webservices/public/mskb/index.asmx?wsdl
Web Service
Web service is simply an application that exposes a Web-accessible API. That means you can invoke this application programmatically over the Web. Using SOAP Protocol XML+HTTP = SOAP (Simple Object Access protocol).
Web services allow applications to share data. Web services can be called across platforms and operating systems regardless of programming language. Web service makes 100% Interoperability. Web Service consists of HTTP, SOAP, WSDL, DISCO and UDDI.
HTTP is the protocol used to send SOAP message between Web Service and client. Today most of the firewall configured to allows http traffic on port 80. And SSL port 443.
SOAP (Simple Object Access Protocol) is message-based protocol. SOAP messages are nothing but XML document. SOAP messages are standard format that includes Envelop, Header and Body. SOAP just sits top of the HTTP protocols.
WSDL (Web Service Description Language) will describe about methods, data type, input, and output parameters of each Web Methods that supported by web service. WSDL based on XML.
DISCO - Discovery to locate the web service.
UDDI - Universal Description Discovery Integration this is also called web based yellow pages for web service. Once business people developed their Web service they can register under UDDI to other people to use and search.
Web Service is nothing but ASP.NET Application. Web service has. .asmx file extension.
Creating a Proxy class for the Web service
First we need to create a Client project as a C# Console Application project. Click Reference and right click you will see pop-up menu with two options Add Reference and Add Web Reference as shown in Figure 1.

Figure 1. Adding Web Reference
In this menu click Add Web Reference options. You will get pop-up dialog window as shown in Figure 2.

Figure 2. Browsing a Web Service URL.
In this dialog an Address filed enter this URL http://rob.santra.com/webservices/public/mskb/index.asmx this will add proxy object to our client project so that we can have reference to this web service. Then click go arrow this will shows the entire web Methods which is supported by this above web Service. As shown in Figure 3.

Figure 3. MSKB Web Service Methods.
Once you finish this process, we have successfully created a Proxy class for the Web service. Now we are ready to invoke the web methods.
Client Code to Invoke the Web Service
using System; using System.Data ; using System.Data.SqlClient; using System.Windows.Forms;// This namespace is not required for //webSerivice the reason I added is to use MessageBox to capture the //results using Ragavan; namespace SreeniSharp { /// <summary> /// This Implementation of Basic Database Operations in C# /// </summary> class Class1 { /// <summary> /// Class Implementations /// </summary> [STAThread] static void Main(string[] args) { //creating instance of Webservice. com.santra.rob.MSKB msWS= new com.santra.rob.MSKB(); //This WebMethod will take Knowledge base ID as input and returns //corresponding Title of the article for that KB ID. string sTitle = msWS.KBTitle("Q142959"); //This WebMethod will take Keyword as a string to look for KB database // and returns the result string sSearchResult= msWS.KBSearch("XML"); //This WebMethod will take Knowledge base ID as input and returns //corresponding article for the KB ID. string sFullListString = msWS.KBFullList("Q142959"); MessageBox.Show(sFullListString,"Ragavan WebService Result"); Console.Read(); } } }
Output of Web Methods
KBTitle [WebMethod output] This WebMethod will return string as Article Title

KBSearch [WebMethod output] This WebMethod will return Search result based on search string as XML Data Island.

KBFullList [WebMethod output] This web Method will returns full article content based on Article ID.

|
|
Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post
Here.
|
|
|
|
|
Login
to add your contents and source code to this article
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional
consulting company, our consultants are well-known experts in .NET and many of them
are MVPs, authors, and trainers. We specialize in Microsoft .NET development and
utilize Agile Development and Extreme Programming practices to provide fast pace
quick turnaround results. Our software development model is a mix of Agile Development,
traditional SDLC, and Waterfall models.
|
|
Click here to learn more about C# Consulting. |
|
|
|
|
|
|
|
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon.
Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees.
As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
|
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
|
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
|
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
|
|
|
|
|
|
|
|
|
|
|
|
|