-
Notifications
You must be signed in to change notification settings - Fork 2
/
SOAP Web Service - Polling for updates.html
executable file
·43 lines (43 loc) · 4.22 KB
/
SOAP Web Service - Polling for updates.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!-- page=SOAP Web Service - Polling for updates -->
<!-- uid=ff2919e5375a25561a1b0309484689f8bcc5a557 -->
<!-- time=1347893010 -->
<!-- ip=66.134.198.26 -->
<!-- content-type=text/html -->
<!-- name=Brendan Caffrey -->
<!-- email=brendan@litmusapp.com -->
<p style="font-weight:inherit;font-style:inherit;font-size:13px;font-family:inherit;vertical-align:baseline;line-height:1.5em;padding:0px;margin:0px;border:0px;">Now that we've sent the email, Litmus has received it and our test has started (as shown by emailTest.State changing to "processing"), we can begin polling for updates.</p>
<p> </p>
<p style="font-weight:inherit;font-style:inherit;font-size:13px;font-family:inherit;vertical-align:baseline;line-height:1.5em;padding:0px;margin:0px;border:0px;">You should poll for updates once every 60 seconds. Please do not exceed this and poll more frequntly or your results may update less often as frequent updates trigger more agressive caching on our web servers. If you do need to poll more often, please <a style="font-weight:inherit;font-style:inherit;font-size:13px;font-family:inherit;vertical-align:baseline;color:#114488 !important;padding:0px;margin:0px;border:0px;" href="mailto:resellers@litmusapp.com?subject=We%20may%20need%20to%20poll%20more%20frequently">contact us</a>.</p>
<p> </p>
<p>Here is how your application should function when polling, starting with the initial test creation for clarity:</p>
<p> </p>
<ol><li>CreateEmailTest</li>
<li>Send your email</li>
<li>Wait for 60 seconds</li>
<li>GetEmailTest</li>
<li>Wait for 60 seconds</li>
<li>GetResult for each pending result (explained below)</li>
<li>Wait 60 seconds</li>
<li>Repeat steps 6 and 7 until all results are returned</li>
</ol><p> </p>
<h2>Using GetResult to retreive a single result</h2>
<p>The Litmus Web Service supports an optimisation that allows you to request just one result at a time, instead of the entire EmailTest. In the example code below, we'll iterate through each of the results in emailTest, only checking for updates if they have not yet completed.</p>
<p> </p>
<pre>var allFinished = false
while (allFinished = false)
{
for (var i = 0; i < emailTest.Results.Count; i++)
{
var result = emailTest.Results[i]
if (result.Completed = false)
{
emailTest.Results[i] = LitmusApi.GetResult(result.Id)
}
}
Sleep(60000) // You must not check more often than once every 60 seconds
}
</pre>
<p> </p>
<p>What we're doing above is iterating through each result, replacing it with the return value of GetResult. But we're only doing that if the result is not yet completed. </p>
<p> </p>
<!-- pbraw=eJzNVttu20YQfedXTF00sRFdbUuWZVttkjZtgKIN4hRGUfRhRQ7FTVZcdrmUzBb5957ZlSwlFtA+FeUDqb3N5Zwzs6rUgqe3Pz9/Q3c8p1t2K50ydYneWGN0uaDcOmqqTHmuk0Zn0zw/vRxe8ujsYqROR6PxUA3ng7PB5fnkfDy5zCfzNB2p0egi8XrJ0+HZ+cXk8mwwHCS6mo7HPUz0hpeT3uk4SW3pufRd31Y89Xzv+4VfmqRUOPfCcZmpkl6qPHfcJrxU2kzncfYbo/2yqVVV9VK7TORUd6XdQpfT0ibdbpe+VV7RK2Rg1zVhIrmuqPat4ZujHF67a9aLwk91WbDT/irMhfXPpvSfkkJ1H4e5WmrTPmxZsfM6VaarjF6U07mqGYjxlby6RfQw7I14eVWpLAOW0wEsLVUIVH7OrcvYhZ9Hs5/smnyhPK356YqpBjIYM4XMO/RjSJkKVZPjlPWKM9KeVJmRbRyBHR8Wa6+cx9qx/C7suqR5G228w5berQeRlBaqXAi53tJR5WzKdY3h0UkH3ikF7nPGOlWPNdC77lczwDl7Us7r6moz+r+D+6ttBI3GZCGn/YTIlhA8w19L4wFwhyyzukdvDMMnZZZK64nvUwaqvtB1wDxYWVrHBHn+0ZTetASbrXDhuG6Mr2mp2o0TMgCYbA65E3gJR4TfbQje6cWCXTSoFk7oWAkRaSHw2zJwvEaB1ihQdgjvdS7OQnghMLsXUnDUoSpksOFJ/XcUpdZYN/1yODw/n0zoC72srPOq9P+GKSoc5zdHoldvpwCCjUG+n1b813Uzf8+pv7njr04HgBlvQ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