Hi,
I'm having problems with an asp.net application and an existing webservice (with Async methods). Generally, the code works like this:
1) the user starts a 'session' (= a connection to a PBX / call center).
2) a webservice method is called to listen for all events (call center agent loggin in, setting a pause activity, ...). This method is called GetEvents (will raise GetEventsCompleted when something is received).
3) once GetEventsCompleted is raised, the user should do a new request for new events. If not, an "are you alive" event is raised (in the GetEventsCompleted sub). If the (getEvents method) isn't launched within 60sec, the session gets disconnected automatically.
At this moment, I succeed in
1) starting the session (I call the GetEvents method)
2) I receive the first event in getEventsCompleted (agent = ready)
3) session stops because I don't launch a new GetEvents method and the "are you alive" event isn't answered.
So, now I try to call the GetEvents method again when entering the GetEventsCompleted code. This seems to work. Every time I receive an event, I tell the application to wait for new events. Like expected, the webpage keeps loading...
But...I placed a textbox in an UpdatePanel, hoping this textbox would show the last event. However, the box stays empty. (the page itself doesn't seem to keep loading, because I'm using the UpdatePanel). Debugging shows the session stays open (which is ok). The UpdatePanel has the property updateMode="always" (also tried with conditional & updating the panel by code)
Anybody know how to solve this problem? Below, the actual (relevant) code... The async methodes and events work correctly in a windows form application, but there I don't have to deal with postbacks, ...
ASP.NET code:
code behind:
I'm having problems with an asp.net application and an existing webservice (with Async methods). Generally, the code works like this:
1) the user starts a 'session' (= a connection to a PBX / call center).
2) a webservice method is called to listen for all events (call center agent loggin in, setting a pause activity, ...). This method is called GetEvents (will raise GetEventsCompleted when something is received).
3) once GetEventsCompleted is raised, the user should do a new request for new events. If not, an "are you alive" event is raised (in the GetEventsCompleted sub). If the (getEvents method) isn't launched within 60sec, the session gets disconnected automatically.
At this moment, I succeed in
1) starting the session (I call the GetEvents method)
2) I receive the first event in getEventsCompleted (agent = ready)
3) session stops because I don't launch a new GetEvents method and the "are you alive" event isn't answered.
So, now I try to call the GetEvents method again when entering the GetEventsCompleted code. This seems to work. Every time I receive an event, I tell the application to wait for new events. Like expected, the webpage keeps loading...
But...I placed a textbox in an UpdatePanel, hoping this textbox would show the last event. However, the box stays empty. (the page itself doesn't seem to keep loading, because I'm using the UpdatePanel). Debugging shows the session stays open (which is ok). The UpdatePanel has the property updateMode="always" (also tried with conditional & updating the panel by code)
Anybody know how to solve this problem? Below, the actual (relevant) code... The async methodes and events work correctly in a windows form application, but there I don't have to deal with postbacks, ...
ASP.NET code:
Code:
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:button ID="btnStartSession" runat="server" Text="start session" />
event: <asp:TextBox ID="txtEvent" runat="server" TextMode="MultiLine" Height="200px" Width="500px"></asp:TextBox><br />
agent event: <asp:TextBox ID="txtAgentEvent" runat="server" TextMode="MultiLine" Height="200px" Width="500px"></asp:TextBox><br />
</ContentTemplate>
</asp:UpdatePanel>
<asp:TextBox ID="txtInfo" runat="server"></asp:TextBox>
code behind:
Code:
Private Sub btnStartSession_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnStartSession.Click
NASWebServiceProxy.GetEvent01Async(Session("applicationID"), False)
End Sub
Private Sub NASWebServiceProxy_GetEvent01Completed(ByVal sender As Object, ByVal e As NASWebServiceProxy.GetEvent01CompletedEventArgs) Handles NASWebServiceProxy.GetEvent01Completed
Try
'fill txtbox with event info
txtEvent.Text = Now.ToLongTimeString() & .....
Catch ex As Exception
...
End Try
NASWebServiceProxy.GetEvent01Async(Session("applicationID"), False)
End Sub