locked
How to create a web service RRS feed

  • Question

  • Hello,

    I've to implements an application that do the following:

    - Take some .xls files information and unified all data in an unique file

    - Publish the unified file on a web page using an IIS

    - Refresh the information published every 30 minutes

    Actually, there´s a windows service application implements in VB.net that retrieves data and unified it on a .mdb data base (result file), the procedure has a timer that enables thread starts every 30 minutes... in order to refresh info...

    How could we publish the info on the web ? Using a web service?

    I'd appreciate your advices, thanx 

     

    Wednesday, December 13, 2006 12:07 AM

Answers

  • As If your talking about a client application which is going to send the data to a Web service then you probably want to look at the following tutorials about Web Services and VB.NET

    Your probably going to want to read a  little about these before attempting to create your own.

    You client application would then periodically call the web service to sent it the updated information.

    Or, It may be as simple as uploading a file to the server using

    My.Computer.Network.Upload File
    http://msdn2.microsoft.com/en-us/library/dfkdh7eb.aspx

    And simply updating a file on the web server which your web application uses to display information.

     

     

    Wednesday, December 13, 2006 5:31 AM
  • MariamCR

    1. Create a new Active Server Pages (ASP) .NET Web service project. Name the Web service MathService and point the location to an appropriate Web server that is running ASP.NET if necessary.

    2. Change the name of the Solution file to MathService for consistency.

    3. Change the name of the default Web service that is created from Service1.asmx to MathService.asmx .

    4. Click Click here to switch to code view in the designer environment to switch to code view.
    Change the name of the class from Public Class Service1 to Public Class MathService .

    5. Define methods that encapsulate the functionality of your service. Each method that will be exposed from the service must be flagged with a WebMethod attribute in front of it. Without this attribute, the method will not be exposed from the service.

    NOTE : Not every method needs to have the WebMethod attribute. It is useful to hide some implementation details called by public Web service methods or for the case in which the WebService class is also used in local applications. A local application can use any public class, but only WebMethod methods will be remotely accessible as Web services.

    6. Add the following method to the MathServices class that you just created:

    <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

           Return A * B

    End Function

     

    <WebMethod()> Public Function Divide(A As System.Single, B As System.Single) As System.Single

    If B = 0

    Return -1

    End If

    Return Convert.ToSingle(A / B)

    End Function

    7. Click Build on the Build menu to build the Web service.

    8.  Browse to the MathService.asmx Web service page to test the Web service. If you set the local computer to host the page, the URL is http://localhost/MathService/MathService.asmx.

    The ASP.NET runtime returns a Web Service Help Page that describes the Web service. This page also enables you to test different Web service methods.

     

    1. Create a new Console Application project.

    2. Add a reference for the MathService Web Service to the new console application.
    This step creates a proxy class on the client computer. After the proxy class exists, you can create objects based on the class. Each method call that is made with the object then goes out to the uniform resource identifier (URI) of the Web service (usually as a SOAP request).

    3. On the Project menu, click Add Web Reference. In the Add Web Reference dialog box, type the URL for the Web service in the Address text box and press ENTER. If you set the local computer to host the Web service, the URL is http://localhost/MathService/MathService.asmx. Click Add Reference. Expand the Web References section of Solution Explorer and note the namespace that was used.

    4. Create an instance of the proxy object that was created. Place this code in the Main procedure of the Module1 module:

    Dim myMathService As localhost.MathService = New localhost.MathService()

    5. Invoke a method on the proxy object created in the previous step:

    Console.Write("2 + 4 = {0}", myMathService.Add(2,4))

    Monday, December 18, 2006 8:23 AM

All replies

  • As If your talking about a client application which is going to send the data to a Web service then you probably want to look at the following tutorials about Web Services and VB.NET

    Your probably going to want to read a  little about these before attempting to create your own.

    You client application would then periodically call the web service to sent it the updated information.

    Or, It may be as simple as uploading a file to the server using

    My.Computer.Network.Upload File
    http://msdn2.microsoft.com/en-us/library/dfkdh7eb.aspx

    And simply updating a file on the web server which your web application uses to display information.

     

     

    Wednesday, December 13, 2006 5:31 AM
  • MariamCR

    1. Create a new Active Server Pages (ASP) .NET Web service project. Name the Web service MathService and point the location to an appropriate Web server that is running ASP.NET if necessary.

    2. Change the name of the Solution file to MathService for consistency.

    3. Change the name of the default Web service that is created from Service1.asmx to MathService.asmx .

    4. Click Click here to switch to code view in the designer environment to switch to code view.
    Change the name of the class from Public Class Service1 to Public Class MathService .

    5. Define methods that encapsulate the functionality of your service. Each method that will be exposed from the service must be flagged with a WebMethod attribute in front of it. Without this attribute, the method will not be exposed from the service.

    NOTE : Not every method needs to have the WebMethod attribute. It is useful to hide some implementation details called by public Web service methods or for the case in which the WebService class is also used in local applications. A local application can use any public class, but only WebMethod methods will be remotely accessible as Web services.

    6. Add the following method to the MathServices class that you just created:

    <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

           Return A * B

    End Function

     

    <WebMethod()> Public Function Divide(A As System.Single, B As System.Single) As System.Single

    If B = 0

    Return -1

    End If

    Return Convert.ToSingle(A / B)

    End Function

    7. Click Build on the Build menu to build the Web service.

    8.  Browse to the MathService.asmx Web service page to test the Web service. If you set the local computer to host the page, the URL is http://localhost/MathService/MathService.asmx.

    The ASP.NET runtime returns a Web Service Help Page that describes the Web service. This page also enables you to test different Web service methods.

     

    1. Create a new Console Application project.

    2. Add a reference for the MathService Web Service to the new console application.
    This step creates a proxy class on the client computer. After the proxy class exists, you can create objects based on the class. Each method call that is made with the object then goes out to the uniform resource identifier (URI) of the Web service (usually as a SOAP request).

    3. On the Project menu, click Add Web Reference. In the Add Web Reference dialog box, type the URL for the Web service in the Address text box and press ENTER. If you set the local computer to host the Web service, the URL is http://localhost/MathService/MathService.asmx. Click Add Reference. Expand the Web References section of Solution Explorer and note the namespace that was used.

    4. Create an instance of the proxy object that was created. Place this code in the Main procedure of the Module1 module:

    Dim myMathService As localhost.MathService = New localhost.MathService()

    5. Invoke a method on the proxy object created in the previous step:

    Console.Write("2 + 4 = {0}", myMathService.Add(2,4))

    Monday, December 18, 2006 8:23 AM