Web services string updates

K

Kevin Gibbons

Hi,

I have written a chat application to write new messages collected from
a web service to the screen, however I am having problems adding the
messages to the last received messages.
At the moment only new messages are being displayed. I'm sure that
this shouldn't be too difficult but would be grateful for some help.
I've attached the javascript and html to get the new messages:

<%@ Page language="c#" Codebehind="MessageWindow.aspx.cs"
AutoEventWireup="false" Inherits="Chat.Chat.MessageWindow" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<script language="javascript">
var iCallID;
var lastmessage = "";
var newmessage = "";

function init()
{
service.useService("http://localhost/chat/chat/messages/instantmessages.asmx?WSDL","InstantMessages");
setInterval( "GetNewMessages()", 100 )
}
function GetNewMessages()
{
GetLastMessage();
iCallID = service.InstantMessages.callService( "GetMessages" );
}
function onWSresult()
{
if((event.result.error)&&(iCallID==event.result.id))
{
var xfaultcode = event.result.errorDetail.code;
var xfaultstring = event.result.errorDetail.string;
var xfaultsoap = event.result.errorDetail.raw;
document.writeln("ERROR. Method call failed!");
document.writeln("Call ID:" + iCallID);
document.writeln("Fault Code:" + xfaultcode);
document.writeln("Fault String:" + xfaultstring);
document.writeln("SOAP Data:" + xfaultsoap);
}
else if(event.result.error == false)
{
newmessages.innerText = newmessages.value + event.result.value;
}
}
function GetLastMessage()
{
oldmessages.innerText = oldmessages.value + newmessages.value;
}
</script>
<html>
<head>
<title>MessageWindow</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body onload="init()">
<div id="service" style="behavior:url(webservice.htc)"
onresult="onWSresult()"></div>
<form runat="server">
<span id="oldmessages"></span>
<span id="newmessages"></span>
</form>
</body>
</html>

Thanks in advance,

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top