webservice异步调用和会话管理? [英] webservice asynchronous call and session management ?

查看:82
本文介绍了webservice异步调用和会话管理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有两页.从第一页开始,我正在异步调用Web服务,但是该服务需要时间才能返回结果,因此我想同时转到下一页,当我返回第一页时,它应该显示结果如果完成了,请从网络服务中获取.........请指导我如何实现此方法?

i have two pages on my website .From first page i am calling a webservice asynchronously but the service takes time to return result so i want to go to next page meanwhile and when i return back to first page it should display the result from webservice if completed ......please guide me how to implement this ?

推荐答案

我正在考虑实现异步调用.

1.在您的Web服务中,创建一个状态日志修复程序,该修复程序具有状态(进行中,已完成,错误),状态消息等
2.在首页aspx中实现异步调用
3.在第二页中,阅读状态日志并显示到该页面,然后每隔1分钟执行一次,这样用户就无需刷新代码.您可能可以使用ajax进行部分页面回发:)
I am thinking to implement asynchronous call.

1. In your webservice create an status log fix that has the status (inprogress, completed, error), status message, etc
2. Implement async call in your first page aspx
3. In your second page, read your status log and display to the page and do it every after 1 minute so that the user will not need to refresh the code. you can probably use ajax for the partial page postback :)


您可能可以使用类似的方法来编写xml文件:

you can probably use something like this to write an xml file:

Public Sub WriteOutputLogFile(ByVal isCompleted As Boolean, ByVal statusMessage As String)

        Dim writer As New System.Xml.XmlTextWriter("C:\MySampleXmlFile.xml", System.Text.Encoding.UTF8)

        writer.WriteStartDocument(True)
        writer.Formatting = System.Xml.Formatting.Indented
        writer.Indentation = 2
        writer.WriteStartElement("MyOutputog")

        '<statusmessage>Hello World Sample</statusmessage>
        writer.WriteStartElement("StatusMessage")
        writer.WriteString(isCompleted.ToString())
        writer.WriteEndElement()

        writer.WriteEndElement()
        writer.WriteEndDocument()
        writer.Close()


    End Sub


这篇关于webservice异步调用和会话管理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆