Use vs.net to create a webservice + flash Calculator

Source: Internet
Author: User

'================================
'Reprinted please keep the following information
'Original: Ouyang dongjie
'Http: // www.cnsxml.com
'================================
After reading this tutorial, you will find that webservice is really simple on. net!
We want to use vs.net to create a simple webservice. Its function is to perform simple arithmetic operations.
Then create a flash to call this webservice
1. Create a WEBSERVICE
1. Open Visual Studio. NET.
2. Create a New Active Server Pages (ASP). NET Web service project.
Name the Web Service OydjService and specify its location as an appropriate
When the Web server that runs ASP. NET.
3. Change the Solution file name to OydjService to be consistent.
4. Change the name of the default Web service created with Service1.asmx to OydjService. asmx.
5. Click here in the design environment to switch to the Code view.
6. Define methods to encapsulate your service functions.
Each method provided by this service must be preceded by a WebMethod attribute. If this attribute is not available, the service will not disclose this
Method.
Note: Not every method requires the WebMethod attribute.
It is useful to hide some implementation details called by common Web service methods.
In the case of WebService classes, you also need to hide some implementation details.
Local applications can use any public class, but only methods with the WebMethod attribute can be used as Web
Remote service access.
Add the following code to the OydjServices class you created earlier:
Program code:
<WebMethod ()> Public Function Add (a As Integer, B As Integer) As Integer
Return (a + B)
End Function
<WebMethod ()> Public Function Subtract (A As System. Single, B As System. Single) As System. Single
Return A-B
End Function
<WebMethod ()> Public Function Multiply (A As System. Single, B As System. Single) As System. Single

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.