ASP.NET Web Services Tutorial in Urdu Computer Education for All Part 1

Today Our Topic is about web services before i started it properly let me describe you the background knowledge. Then Move Next! e.g. Like how we made Web Application. Now Make a website and launch it… But Unfortunately Many people haven’t allocated project on Web. Mostly People allocated on smart devices project e.g. some one has Windows Phone, Android or Someone has Project on I phone. Who project on standalone applications like a game. Which Applications involves Databases, like Payroll System They have to Generate Salaries of Company Employees. Now they have an application on their Android Phone where they generate salaries. But its not necessarily that there should be installed a database. Like I m working on this machine but it’s not a database server I use Main Server to connect database. Okay! Now! This Machine has operating system windows and that server has also and they are compatible. Let’s suppose that on Apple Machine I run an application but another used in Java or Android I want to access servers from them may be it didn’t give me access. Is it Possible? It’s possible but if may be Allow on local LAN port or any IP. if I work on internet they don’t dispose IP, Ports etc. They allow through secure mediums. Means if I talk about databases, I never give my user name and password to anybody. Nor give any access with database, it also be possible I may blocked database ports, because system can be down with pinging. Okay So, Best method is this that you made another application on it and communicate through this application and may be this application on HTTP, communicate on browsers. Like that suppose I ask you to make an application which dependent on another application. That’s only an example of HTTP. If you thought more ahead you may be saw peoples made online applications and they read data from another e.g. I make a website about data exchange money transfer system where currency changing etc Dollars to Rupees, Chinese currency, convert to riyal, you write an amount and convert it to any other currencies. Currency rate hundred and ten percent corrects always. What’s mean it? Why it works? It Mean back side some Web services are used… let’s suppose to make little currency changing website. two text boxes on your website. 1st text box show 1 $. Design Button Convert to Rupees another text box shows read only Rupees Defines Rates with your knowledge How can you get rates? rates are changing day by day. Its means your data conversion must read from another sources. That can be a central site or server which updates every seconds its data, its gives you up to date data from get and set method Okay, Its mean, i want to read a data from other source to my website. But i want to make my website that provides that things…currency conversation must be on my website? i take that information to request that other web services This information comes from other web services but i show it on my website How This Communication Works? There are different types of have. You saw people made Apps for twitter, Facebook Did you Work Ever on Amazon??? People made Books Data Sites on Amazon. There shows details of Books Prices etc There is no Local Database in Amazon.. Its mean Amazon Provides you a service. You request Amazon to show the list of Books. Its Shows you. It didn’t return the Page. It provide you the data in raw forms. That Data may be in Array Forms or something else You can show that Array Data in Grid View. Programmers made third party Applications Which have no self interface But. They Works as a services providers Okay, you can request that application that i need something. It will respond you take it.. That can be a Web Page, Special HTML, or Raw Form Data. Raw Examples or JSON or XML Did you Know XML, Jason? JSON is another format Your Information represents with such notations that easily can be read and write. But again you didn’t make any kind of logic for that because there are classes for serialization and DE-serialization. If you work on I Phone or C sharp (C#) it can automatically serialized or DE-serialized. If as a programmer, I made a website for anyone, and data can be retrieved from other sources, it’s not mean there are database server its mean 3rd party application services. That application gives me data in Array forms or XML or JSON formats. You as a programmer data retrieved and show in any Grid view or represent it any list box or tables. Now that data which access may be an application source. That Application is basically Special Type of application. Which has infected no interface, no button; no label means no table nor made any type of tree or any control. You technically request it and it technically respond you the DATA. That application we may call as General language Service Application. If it’s on Web that called Web Services. So, Web Service is basically a Stand Alone Application or Application Component. Web Service is basically an Application Component. Okay, this works like a source for End user or Technical User.
Is It Clear? If you make application on android you cannot queries in databases for this purpose it will use another application where data is get and show it in graphs or chart what eve he wants. He Hold the data. Data in Raw Forms now we actually create that Data Provider. Today we Design Web Service not a Web Site. Okay! Web Service Begins with .ASMX, You familiar with .ASPX that use in for web forms or websites. Similarly in Java rest Base and PHP is also rest base are another services. Anyway! Microsoft started Web Services with extension ASMX. There you didn’t see any Text Boxes or interfaces. That provides you information as a programmer to show data in Grid View or text box etc. Okay. Now! We learn WCF Base Web Services. WCF stands for Windows Communication Framework. Microsoft introduced two new areas WCF and WPF. WPF stands for Windows Presentation Framework. In WPF Microsoft strong UI which is based on XML interface. Who used window base apps works that is WPF extension all codes on C# (C Sharp). WCF is a communication Framework. Currently I am telling you the interface basically this is communication Interface. Mean an Application which communicates with clients. Okay, So this WCF web services runs on different codes, but we work on HTTP protocols, and run it on HTTP protocols Okay! WCF extension is SVC. We use it. Someone talking about Rest base I explain it’s different. Remember in WCF there is no Interface Its Services Provider only You can send it request and its will respond you. We talked about HTTP, it’s a communication protocol. It works Like you work on TCP or UDP. HTTP is understandable for Browsers. Browsers request to servers in the form of HTTP protocols and data get in the form of tags or HTML But there are two modes one is JSON and Two is XML. JSON is advance version of send and receiving data that shrink data and reduce size. In JSON data travels in the forms of strings there are no tags open and closing etc. Now we see how we make WCF? How we make Web Based Service? ASMX is a part of WCF and I recommend using WCF it’s an advance version. First of All we open Microsoft Visual Studio 2012 and then go File Menu and Create New Project.
There are Some Options. In Visual C# we have a WCF section. Select it and filter its application types. We Select WCF Service Application. Okay! Name it FirstService and Save it. By default there are two classes made.
IServices1 is by default and Service. By Default its makes two functions in interface IService1. Interface always public. You can see in square bracket [ ] . This is basically Contract. See 2nd class Service1
Its also C# class. Its is inheritance from IService1
IService1 gives this Service1 class contacts. We will make our methods. Remove all functions empty the class. We write our functions in Service Contract, that function calls user lists. Now run it. Using -/ we pass the parameters
Now it has no interface. Call function using /UsersName
Till that we didn’t make anything. So stop it. We make rest base Web Services. That is modes XML or JSON to Respond Data.
Name anything can be used. Now changing in configuration file that is Web.config Services name are important to convert its behavior to rest.
Start and Ending Points also important. Behavior name can anything.
MyWeb is currently Behavior name. Configuration is completed. Build it and Run It. We will see Behavior will be changed.
Let’s check this mistake in code.
Extra behavior needs to close.
Protocol Mapping is needed to comments. Mistake in WebInvoke=?
We use WebGet because we get the data….
Now its Okay… This is Formatted String in JSON FORMAT
Square Brackets called Array… So Data populated in the Array of Strings
We can change into XML mode also Lets try it. Use XML Format
You can see the XML mode as well.
Let’s see model change only changes Strings but Data are the Same. JSON is more popular then XML Web services part 1 finished but in Part 2 will be learn … We will use this Web Service into my web service drop down boxes,
In Beginning we done mistake in our WebInvoke…
If we use it we have to add an attribute like Method
Then it also works…. In Next Lecture we will learn about Connectivity with any Application to Database…
I hope you learn something new and thanks for Watching this Video
Please Like, Comment , Share and Subscribe This Channel for more videos

Add a Comment

Your email address will not be published. Required fields are marked *