• λ我爱Aspx >> Asp.Net >> Consuming a Webservice Part 2 of 2[等级:高级](转载:aspfree)
  • Consuming a Webservice Part 2 of 2[等级:高级](转载:aspfree)

  • :aspxer  Դ:internet  :2007-5-28 20:37:28  ؼ:web,asp,webservice
  • <%@ Import Namespace="AspX123" %>

    Now that we have our namespace, we can dimension a variable to hold an instance of our webmethod, and call our webmethod.

    Dim myWebSvc as AspX123.AspX123WebSvc = New AspX123WebSvc()

    Dim ds as DataSet

    ds = myWebSvc.GetNewResources()

    AspX123WebSvc is our class we defined in our webservice, and GetNewResources() is our webmethod that returns our dataset.

    Additional Notes

    Because www.123aspx.com is really only updated once a day, we don@#t want to have to call the webservice every time someone views our website. Instead, we want to cache the default dataview of the dataset on our webserver, and set it to expire every 12 hours. The following code will achieve this.

    Dim CACHE_DURATION as Integer = 12

    Dim aspXNewResources as DataView

    aspXNewResources = Ctype( Cache("aspXNewResources"),DataView )

    Ҷƪл˵?
  • һƪCreate and Control Windows Services--Not a Slap Shot, but Almost as Fast[等级:高级]
    һƪCreating a Webservice Part 1 of 2[等级:高级](转载:Aspfree)