Step by step to start Web service (with code and map)
Mood
2001-07-31
One look, I know that this is about Web Service, but I don't want to write any of the theory, I just want to practice it through an example, I hope you will be the same, then this article will help you.
I don't want to do it with vs.net because I'm on the machine. Net is broken, I want to do only by DOTNET FRAMEWORK SDK. Going to the end, there is a problem, I think the problem is a problem or the machine's problem. If I can write one, I feel that the order is more accomplished than the graphical interface, and this ZIP package also contains this Error's interface.
The entire example includes all the process of Web Service, I plan to do this:
1. Create an ASP Web Service
2. Complete the .asmx file, then test it in the browser.
3. Create a customer of this Web Service.
4. Customer get this service
My problems are in step 4, the client has never got the location of the Web Service, although they are all on the same machine but do not know each other. Then I use vs. Net does not have any questions, almost all the process zip packs, and I still want to try the distribution of the NET program, VS is also very good.
There is a file and code of the entire Project in WebServiceAll.zip in the zip package.
However, it is best to install VS.NET Beta 2, you have to install Framework SDK Beta 2 at least.
Specifically:
1. Create an ASP Web Service project in VS.NET, and then implement your feature in the generated .asmx class is Service, I wrote two simple functions, one is the HelloWorld function returns a "helloworld" string . The other is an ADD operation to return two numbers. Ok, set it to the default page, f5. If there is no error IE, IE should be automatically started. And the ordinary syntax is not different, the only thing is to add a webmethod tag in front of the function.
VB: PUBLIC FUNCTION
C #: [WebMethod] Public Void Int Add (Int A, INT B) {Return A B;}
VS. Net will help you generate a .asmx.vb file with your code, if you are manual, you can write directly. Sasmx.
2. You can see a very format page Show you just two functions (or service) or even you can do it, such as "HelloWord", "HelloWord" and 3 2 get 5 results, so Web Service has established successfully .
3. You need to build a Web Service customer, let it get these services you provide to get "HelloWord" and add results. All you need to generate an SDL file, it is similar to IDL, IDL compiles form a type library, enabling VB's development, and then VB, InterDev development environment can display intelligent help.